Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Queue Tree Amazon

Level order traversal line by line Set 2 (Using Two Queues)

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...
Stack Tree Stack

Iterative Postorder Traversal Set 1 (Using Two Stacks)

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

Iterative Postorder Traversal Set 2 (Using One Stack)

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...
Graph Stack DFS

Iterative Depth First Traversal of Graph

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...
Binary Search Tree Stack Tree

Check if a given array can represent Preorder Traversal of Binary Search Tree

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...

Subscribe to Our Newsletter