Courses
Tutorials
Interview Prep
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.4K+ articles
Misc
7.7K+ articles
Searching
1.0K+ articles
Tree
911+ articles
Recursion
591+ articles
DFS
360+ articles
Binary Tree
330+ articles
Queue
225+ articles
tree-level-order
123+ articles
Tree Traversals
106+ posts
Recent Articles
Popular Articles
POTD Solutions | 20 Nov’ 23 | K Sum Paths
Last Updated: 23 July 2025
View all POTD SolutionsWelcome to the daily solutions of our PROBLEM OF THE DAY (POTD). We will discuss the entire problem step-by-step and work towards developing an opti...
read more
DSA
Binary Tree
Tree Traversals
GFG-POTD-Solutions
Tree Traversal Techniques in Python
Last Updated: 23 July 2025
A tree is a non-linear data structure or we can say that it is a type of hierarchical structure. It is like an inverted tree where roots are present at the top and leaf or...
read more
Python
Picked
Tree Traversals
Python-DSA
Time and Space Complexity Analysis of Tree Traversal Algorithms
Last Updated: 31 May 2023
Let us discuss the Time and Space complexity of different Tree Traversal techniques, such as Inorder Traversal, Preorder Traversal, Postorder Traversal, etc.Time Complexit...
read more
Tree
DSA
Inorder Traversal
Preorder Traversal
PostOrder Traversal
tree-traversal
Data Structures-Tree Traversals
Tree Traversals
Complexity-analysis
Preorder Traversal of Binary Tree
Last Updated: 08 December 2025
Preorder Traversal is a method to traverse a tree such that for each node, you first visit the node itself, then traverse its left subtree, and finally traverse its right ...
read more
Tree
DSA
Binary Tree
Tree Traversals
Binary Search Tree (BST) Traversals – Inorder, Preorder, Post Order
Last Updated: 23 July 2025
Given a Binary Search Tree, The task is to print the elements in inorder, preorder, and postorder traversal of the Binary Search Tree. Input: A Binary Search TreeOutput: I...
read more
Binary Search Tree
Recursion
Picked
DSA
Tree Traversals
Binary Tree Iterator for Inorder Traversal
Last Updated: 23 July 2025
Given a Binary Tree and an input array. The task is to create an Iterator that utilizes next() and hasNext() functions to perform Inorder traversal on the binary tree.Exam...
read more
DSA
Inorder Traversal
Binary Tree
cpp-iterator
Tree Traversals
Flatten a Binary Search Tree to convert the tree into a wave list in place only
Last Updated: 23 July 2025
Given a Binary Search Tree consisting of N distinct nodes, the task is to flatten the given Binary Search Tree to convert the tree into a wave list. A wave list arr[0..n-1...
read more
Tree
Binary Search Tree
DSA
Inorder Traversal
BST
tree-traversal
Tree Traversals
Create a wave array from the given Binary Search Tree
Last Updated: 23 July 2025
Given a Binary Search Tree, the task is to create a wave array from the given Binary Search Tree. An array arr[0..n-1] is called a wave array if arr[0] = arr[1] = arr[2] =...
read more
Tree
Mathematical
Binary Search Tree
DSA
Arrays
Inorder Traversal
BST
tree-traversal
Tree Traversals
Minimum distance between two given nodes in an N-ary tree
Last Updated: 23 July 2025
Given a N ary Tree consisting of N nodes, the task is to find the minimum distance from node A to node B of the tree.Examples:Input: 1 / \ 2 3 ...
read more
Misc
Tree
DSA
Tree Traversals
n-ary-tree
Left and Right view of a Generic Tree
Last Updated: 23 July 2025
Given a Generic Tree consisting of N nodes, the task is to find the left and right views of the given generic Tree.Examples:Input: 1 / \ 2 3 ...
read more
Misc
Tree
Queue
DSA
Tree Traversals
tree-level-order
Print all the paths from root to leaf, with a specified sum in Binary tree
Last Updated: 23 July 2025
Given a Binary tree and target sum, the task is to find all the possible paths from root to leaf that have the sum equal to the given sum.ExamplesInput: Output: [[10, 28]...
read more
Tree
Stack
Recursion
DSA
DFS
Tree Traversals
Maximize sum of path from the Root to a Leaf node in N-ary Tree
Last Updated: 23 July 2025
Given a generic tree consisting of n nodes, the task is to find the maximum sum of the path from the root to the leaf node.Examples:Input:Output: 12Explanation: The path s...
read more
Misc
Tree
Mathematical
Recursion
DSA
DFS
Tree Traversals
n-ary-tree
Maximum absolute difference between any two level sum in a N-ary Tree
Last Updated: 15 July 2025
Given an N-ary Tree having N nodes with positive and negative values and (N - 1) edges, the task is to find the maximum absolute difference of level sum in it.Examples:Inp...
read more
DSA
BFS
Tree Traversals
Count pairs of nodes having minimum distance between them equal to the difference of their distances from root
Last Updated: 23 July 2025
Given an N-ary Tree consisting of N nodes valued from [1, N], where node 1 is the root, the task is to count the pairs of nodes having minimum distance between them equal ...
read more
Misc
Tree
Searching
Mathematical
Recursion
DSA
Binary Tree
DFS
Tree Traversals
Preorder, Postorder and Inorder Traversal of a Binary Tree using a single Stack
Last Updated: 23 July 2025
Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order iteratively using only one stack traversal.Examples:Input...
read more
DSA
Inorder Traversal
Preorder Traversal
PostOrder Traversal
Binary Tree
Tree Traversals
cpp-stack
1
2
3
4
5
6
7
8