recategorized by
683 views

2 Answers

4 votes
4 votes
Yes It is an inorder traversal of bst..the trick we used here is making the whichnode static to increase it one by one and get our desired node..
0 votes
0 votes
This Hello can be summarized as

1. Go To Left

2. Increment counter "WhichNode". This is static variable , so it will retain values to calls. This will contain When this node will be printed in Inorder Traversal.

3. Go to Right.

It is Left Node Right Traversal & This code would have correctly calculated option A have there not been error in step 3, second call to hello. Hello(t->right, n,p) -> here p is undefined, so correct answer is E. None of the above. (Option which is not given !)

Related questions

2 votes
2 votes
1 answer
1
admin asked Apr 1, 2020
1,039 views
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number number of nodes in a binary tree of height $h$ is $2^{h}$$2^{h-1} ...
2 votes
2 votes
2 answers
2
admin asked Apr 1, 2020
983 views
The number of possible binary trees with $4$ nodes is$12$$13$$14$$15$
1 votes
1 votes
0 answers
3
Rohit Gupta 8 asked Dec 25, 2017
1,110 views
If the average depth of a node in an $n$-node binary search tree is $O(\log{n})$, then the height of the tree is$O(n\log{n})$$O(n)$$O(\log{n})$$O(\sqrt(n\log{n}))$
0 votes
0 votes
5 answers
4
radha gogia asked Sep 30, 2015
1,607 views
If I am given an array $X$ of $n$ distinct integers which is interpreted as a complete binary tree, so if the parent is at index $i$, then it's left child would be at ind...