We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Given the array as is it shouldn't be. However in this program it seems the child nodes are all predefined with that being the case there is nothing pointing to left of 1 both in terms of value and on the tree itself, so it can't print anything. The program then prints 1 first because it's the root then the program looks at the right of the root and then the process repeats itself.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Inorder Traversal
You are viewing a single comment's thread. Return to all comments →
Given the array as is it shouldn't be. However in this program it seems the child nodes are all predefined with that being the case there is nothing pointing to left of 1 both in terms of value and on the tree itself, so it can't print anything. The program then prints 1 first because it's the root then the program looks at the right of the root and then the process repeats itself.