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.
- Tree: Preorder Traversal
- Discussions
Tree: Preorder Traversal
Tree: Preorder Traversal
Sort by
recency
|
63 Discussions
|
Please Login in order to post a comment
Here is the C# 'frame' of the question:
class Solution {
}
If your language is set to Pypy3 the exercise is bugged and you are expected to read the input yourself, which for this question can be quite a bit more challinging. Switch the language to regular python3 and the exercise will function as expected
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
My java solution. I always find recursive traversals so much easier to conceptualize than stacks, etc.