Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.4k+ articles
Mathematical
7.7k+ articles
Searching
1.7k+ articles
Tree
1.4k+ articles
Data Structures
1.1k+ articles
Recursion
1k+ articles
Queue
360+ articles
DFS
340+ articles
Binary Tree
310+ articles
tree-level-order
110+ articles
Tree Traversals
100+ posts
Popular Articles
Recent Articles
Tree Traversal Techniques in Python
Last Updated: 22 January 2024
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
...read more
Python
Tree Traversals
Picked
Python-DSA
Preorder Traversal of Binary Tree
Last Updated: 28 March 2025
Preorder traversal is a tree traversal method that follows the Root-Left-Right order:The root node of the subtree is visited first.Next, the
...read more
Tree
Binary Tree
Tree Traversals
DSA
Binary Search Tree (BST) Traversals – Inorder, Preorder, Post Order
Last Updated: 21 August 2024
Given a Binary Search Tree, The task is to print the elements in inorder, preorder, and postorder traversal of the Binary Search Tree. Inpu
...read more
Binary Search Tree
Recursion
Tree Traversals
Picked
DSA
Similar Topics
DSA
22.4k+ articles
Mathematical
7.7k+ articles
Searching
1.7k+ articles
Tree
1.4k+ articles
Data Structures
1.1k+ articles
Recursion
1k+ articles
Queue
360+ articles
DFS
340+ articles
Binary Tree
310+ articles
tree-level-order
110+ articles
Binary Tree Iterator for Inorder Traversal
Last Updated: 20 February 2023
Given a Binary Tree and an input array. The task is to create an Iterator that utilizes next() and hasNext() functions to perform Inorder tr
...read more
Tree
Inorder Traversal
Binary Tree
Algorithms
Tree Traversals
cpp-iterator
DSA
Height and Depth of a node in a Binary Tree
Last Updated: 03 April 2025
Given a Binary Tree consisting of n nodes and a integer k, the task is to find the depth and height of the node with value k in the Binary T
...read more
Tree
Binary Tree
Height of a Tree
Algorithms
Searching
Binary Search Tree
Recursion
Data Structures
Tree Traversals
DSA
Preorder, Postorder and Inorder Traversal of a Binary Tree using a single Stack
Last Updated: 18 January 2022
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
...read more
Tree
Inorder Traversal
Preorder Traversal
PostOrder Traversal
Binary Tree
Stack
Algorithms
Tree Traversals
cpp-stack
DSA
Sum of all nodes at Kth level in a Binary Tree
Last Updated: 24 November 2023
Given a binary tree with N nodes and an integer K, the task is to find the sum of all the nodes present at the Kth level.Examples:Input:K =
...read more
Tree
Binary Tree
Tree Traversals
tree-level-order
DSA
Check if given Preorder, Inorder and Postorder traversals are of same tree | Set 2
Last Updated: 18 January 2023
Given Preorder, Inorder and Postorder traversals of some tree. The task is to check if they all are of the same tree.Examples:Input : Inorde
...read more
Arrays
Tree
Binary Tree
Algorithms
Advanced Data Structure
Python
Recursion
C Language
Tree Traversals
C Programs
DSA
C/C++ Puzzles
Print path between any two nodes in a Binary Tree
Last Updated: 08 September 2022
Given a Binary Tree of distinct nodes and a pair of nodes. The task is to find and print the path between the two given nodes in the binary
...read more
Tree
Binary Tree
Tree Traversals
DSA
DFS traversal of a Tree
Last Updated: 17 March 2025
Depth-First Search (DFS) is a method used to explore all the nodes in a tree by going as deep as possible along each branch before moving to
...read more
Tree
Inorder Traversal
Preorder Traversal
PostOrder Traversal
DFS
Tree Traversals
DSA
Preorder Traversal of N-ary Tree Without Recursion
Last Updated: 12 March 2025
Given ann-ary treecontainingpositivenode values. The task is to print the preorder traversal without using recursion.Note: Ann-ary treeis a
...read more
Tree
Preorder Traversal
Tree Traversals
n-ary-tree
DSA
Print nodes in top view of Binary Tree | Set 2
Last Updated: 23 December 2023
Top view of a binary tree is the set of nodes visible when the tree is viewed from the top. Given a binary tree, print the top view of it. T
...read more
Tree
Binary Tree
Algorithms
Competitive Programming
Tree Traversals
Hash
C++ Programs
cpp-map
tree-level-order
tree-view
DSA
Check if given Preorder, Inorder and Postorder traversals are of same tree
Last Updated: 30 October 2024
Given the Preorder, Inorder, and Postorder traversals of some trees, the task is to check if they all belong to the same tree.Examples:Input
...read more
Tree
Binary Tree
Tree Traversals
DSA
Check if two nodes are cousins in a Binary Tree
Last Updated: 23 September 2024
Given a binary tree (having distinct node values) root and two node values. The task is to check whether the two nodes with values a and b a
...read more
Tree
Binary Tree
Amazon
Tree Traversals
DSA
Data Structures | Tree Traversals | Question 4
Last Updated: 28 June 2021
What does the following function do for a given binary tree?[sourcecode language="C"]int fun(struct node *root){ if (root == NULL) re
...read more
Data Structures
Data Structures
Data Structures-Tree Traversals
Tree Traversals
DSA
1
2
3
4
5
6
7
8
>>
Last
1
2
3
4
5
6
>>
Last
1
2
3
4
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !