wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Assume that the following values are inserted into binary search tree in the given order : 40, 50, 70, 20, 30, 10, 60, 90, 80, 100. Consider the following function:

Find the output printed by the above function, if the root of the binary search tree is passed to the "tree" function.

Void find (Node*root)
{
if (root == NULL) return;
find (root left)
find (root right);
printf("%d" , root data);
}
struct node
{
int data;
struct node * left;
struct node * right;
} Node;

A
30, 20, 100, 80, 90, 60, 70, 50, 10, 40
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
10, 20, 30, 40, 50, 60, 70, 80, 90, 100
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
10, 30, 20, 60, 80, 100, 90, 70, 50, 40
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
30, 20, 10, 60, 80, 100, 90, 70, 50, 40
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C 10, 30, 20, 60, 80, 100, 90, 70, 50, 40
Binary search tree of given sequence is



The given function perform post order traversal on the binary search tree.
So output is 10, 30, 20, 60, 80, 100, 90, 70, 50, 40.

flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Patterns
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon