Given a Binary Tree, print the nodes level wise, each level on a new line.
Output:
1
2 3
4 5
Recommended: Please solve it on “PRACTICE” first, before...

Share

We have discussed iterative inorder and iterative preorder traversals. In this post, iterative postorder traversal is discussed, which is more complex than the other ...

Share

We have discussed a simple iterative postorder traversal using two stacks in the previous post. In this post, an approach with only one stack is discussed.
The idea i...

Share

Depth First Traversal (or Search) for a graph is similar to Depth First Traversal (DFS) of a tree. The only catch here is, unlike trees, graphs may contain cycles, s...

Share

Given an array of numbers, return true if given array can represent preorder traversal of a Binary Search Tree, else return false. Expected time complexity is O(n).
E...

Share