Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Stack Tree tree-traversal

Inorder Tree Traversal without Recursion

Using Stack is the obvious way to traverse tree without recursion. Below is an algorithm for traversing binary tree using stack. See this for step wise step execu...
Tree threaded-binary-tree tree-traversal

Inorder Tree Traversal without recursion and without stack!

Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree. In this traversal,...
Tree Java-HashMap Payu

Print Postorder traversal from given Inorder and Preorder traversals

Given Inorder and Preorder traversals of a binary tree, print Postorder traversal. Example: Input: Inorder traversal in[] = {4, 2, 5, 1, 3, 6} Preorder traversal pre[...
Binary Search Tree BST PostOrder Traversal

Find postorder traversal of BST from preorder traversal

Given an array representing preorder traversal of BST, print its postorder traversal. Examples: Input : 40 30 35 80 100 Output : 35 30 100 80 40 Input : 40 30 32 35...
Tree catalan Tree

Find all possible binary trees with given Inorder Traversal

Given an array that represents Inorder Traversal, find all possible Binary Trees with the given Inorder traversal and print their preorder traversals. Examples: Input...
Tree tree-traversal Tree

Find n-th node of inorder traversal

Given the binary tree and you have to find out the n-th node of inorder traversal. Examples: Input : n = 4 10 / 20 30 ...
Recursion Tree Binary Tree

Find n-th node in Postorder traversal of a Binary Tree

Given a Binary tree and a number N, write a program to find the N-th node in the Postorder traversal of the given Binary tree. Prerequisite: Tree Traversal Examples: ...
Queue Stack Tree

Level order traversal with direction change after every two levels

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two levels are printed from right to lef...
Tree java-LinkedList tree-level-order

Level order traversal line by line Set 3 (Using One Queue)

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...
Tree Adobe Amazon

Reverse Level Order Traversal

We have discussed level order traversal of a post in previous post. The idea is to print last level first, then second last level, and so on. Like Level order travers...

Subscribe to Our Newsletter