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.
I find this question is confusing. Would anyone help please?
Instruction:
Complete the preOrder function in the editor below, which has 1 parameter: a pointer to the root of a binary tree. It must print the values in the tree's preorder traversal as a single line of space-separated values.
In the sample test cases, there are two input: the root and the input elements. This is the first thing making me confused.
The 2nd thing is that, in the expected output of both samples, the root node is not the first element to be printed. I checked multiple website, Root Node value should be printed first in PreOrder traversal. Is that the question and answer having some problems?
I am new to Binary Search Tree, hope someone can help me.
Thanks
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Preorder Traversal
You are viewing a single comment's thread. Return to all comments →
I find this question is confusing. Would anyone help please?
Instruction: Complete the preOrder function in the editor below, which has 1 parameter: a pointer to the root of a binary tree. It must print the values in the tree's preorder traversal as a single line of space-separated values.
In the sample test cases, there are two input: the root and the input elements. This is the first thing making me confused.
The 2nd thing is that, in the expected output of both samples, the root node is not the first element to be printed. I checked multiple website, Root Node value should be printed first in PreOrder traversal. Is that the question and answer having some problems?
I am new to Binary Search Tree, hope someone can help me. Thanks