Algorithms, Interview, Leetcode, Faang, Tree Traversal.
hand, the right child always has a value greater than its parent. When doing preorder traversal, we will first grab the root which is 3, then left child 2 and 5 on the right child at the end. The ‘pre’ means we access the parent first. And the order output after that would be [ 3, 2, 5 ] This post