Trees and binary search trees interview questions
13 questions on this data structure, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 13 done, 0 saved
Print the nodes visible from the left side of a binary tree.
Reported 47 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2018, geeksforgeeks.org 2016
Find the lowest common ancestor of two nodes in a binary tree.
Reported 46 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2024, geeksforgeeks.org 2015
Compute the height of a binary tree.
Reported 36 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2016, geeksforgeeks.org 2020
Find the diameter of a binary tree, the longest path between any two of its nodes.
Reported 28 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2019, geeksforgeeks.org 2016
Check whether a binary tree is a binary search tree.
Reported 27 times
Read the solutionBinary search treesExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2012, geeksforgeeks.org 2019
Convert a binary tree into its mirror image.
Reported 24 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2016, geeksforgeeks.org 2016
Print the top view of a binary tree.
Reported 22 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2016, geeksforgeeks.org 2021
Print a binary tree level by level in spiral (zigzag) order.
Reported 22 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2021, geeksforgeeks.org 2017
Print every node at distance K from a given node in a binary tree.
Reported 22 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2018, geeksforgeeks.org 2017, geeksforgeeks.org 2017
Print a binary tree column by column, in vertical order.
Reported 18 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2017, geeksforgeeks.org 2014
Print the nodes of a binary tree level by level, from top to bottom.
Reported 17 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2012, geeksforgeeks.org 2017, geeksforgeeks.org 2017
Convert a binary tree into a doubly linked list in in-order sequence.
Reported 17 times
Read the solutionTreesExample sources
3 of the write-ups counted: geeksforgeeks.org 2014, geeksforgeeks.org 2012, geeksforgeeks.org 2014
Find the lowest common ancestor of two nodes in a binary search tree.
Reported 16 times
Read the solutionBinary search treesExample sources
3 of the write-ups counted: geeksforgeeks.org 2021, geeksforgeeks.org 2017, geeksforgeeks.org 2017