In Order tree traversal
EasyGiven a binary tree that contains nodes with numbers, traverse the tree in order and return an array of the node numbers in order.
In Order traversal involves visiting nodes in the following order:
- Left node
- Root node
- Right node
For example, if you're given the following tree;
Your function should return:
[-4, 6, 7, 9, 1, 8]
Try it
Solution
9 Essential Trees & Graphs Coding Interview Problems
Master Trees & Graphs by trying the coding challenges below.
- 1.Inorder TraversalEasy
- 2.Tree SumEasy
- 3.Tree HeightEasy
- 4.LCAMedium
- 5.Max Path SumHard
- 6.Search mazeMedium
- 7.Number of islandsMedium
- 8.Kth SmallestMedium
- 9.Sort K ArraysHard