After introducing traversing trees using BFS and DFS in Tree Traversal – Recursively & Iteratively – Preorder, Inorder, Postorder, it’s time to get some practices! Here are Leetcode questions that appear frequently during tech interviews.
Leetcode problems: https://leetcode.com/problemset/all/
|102. Binary Tree Level Order Traversal||Medium||Typical BFS traversal|
|94. Binary Tree Inorder Traversal||Medium||Typical inorder traversal|
|144. Binary Tree Preorder Traversal||Medium||Typical preorder traversal|
|145. Binary Tree Postorder Traversal||Hard||Typical postorder traversal|
|98. Validate Binary Search Tree||Medium|
|105. Construct Binary Tree from Preorder and Inorder Traversal||Medium||It helps to enhance the comprehension of tree traversals as you need to consider both preorder and inorder at the same time|
|106. Construct Binary Tree from Inorder and Postorder Traversal||Medium||It helps to enhance the comprehension of tree traversals as you need to consider both inorder and postorder at the same time|
|314. Binary Tree Vertical Order Traversal||Medium||It requires BFS to ensure ‘top to bottowm’ and Queue to ensure ‘left to right’|
|366. Find Leaves of Binary Tree||Medium|
Feel free to comment here if you have any confusion or suggestions!