Inorder Tree Traversal without recursion and without stack! – Using Morris Traversal, we can traverse the tree without using stack and recursion.
Data Structures
Detect Cycle in a directed graph using colors-Graph cycle-Depth First Traversal can be used to detect cycle in a Graph. DFS for a connected graph.
Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the…
Intersection of two Sorted Linked Lists – Linked List – Given two lists sorted in increasing order, create and return a new list representing
Java Algorithm – Iterative Postorder Traversal | Set 2 (Using One Stack) – Stack – We have discussed a simple iterative postorder traversal using two stacks
Rearrange a linked list such that all even and odd positioned nodes are together-linked list
Rearrange a linked list in such a way that all odd position
Python Algorithm – Iterative Postorder Traversal | Set 2 (Using One Stack) – Stack – We have discussed a simple iterative postorder traversal
Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the…
Inorder Tree Traversal without recursion and without stack! – Using Morris Traversal, we can traverse the tree without using stack and recursion.
The idea is to use a resizable array (ArrayList in Java, vector in C) together with hashing. Resizable arrays support insert in Θ(1)