suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. the binary search tree uses the usual ordering on natural numbers. what is the in-order traversal sequence of the resultant tree?
Answers
Answered by
8
Dear Student:
The sequence is 0 1 2 3 4 5 6 7 8 9.
Because in-order traversal of a binary search tree gives element in increasing order.The above sequence represents correct order.
Hope it helps
Thanks
With Regards
Answered by
0
If the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. the binary search tree uses the usual ordering on natural numbers, then the in-order traversal sequence of the resultant tree is:
0 1 2 3 4 5 6 7 8 9
- In-order traversal of a binary tree follows the sequence:
Left Subtree -> Root -> Right Subtree
- When we take the in-order traversal of a binary search tree, it always gives us the elements of the tree in the increasing order.
- Since, 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in the binary search tree, the in-order traversal of this tree will give us these elements in increasing order i.e., 0 1 2 3 4 5 6 7 8 9.
- Hence, the in-order traversal sequence of the resultant tree is:
0 1 2 3 4 5 6 7 8 9
#SPJ3
Similar questions