Software-Engineering
October 13, 2023Red-Black-Tree
October 13, 2023NIC-NIELIT Scientist-B 2020
Question 49
|
Binary search tree contains the values 1, 2, 3, 4, 5, 6, 7, 8. The tree is traversed in pre-order and the values are printed out. Which of the following sequences is a valid output?
53124786
|
|
53126487
|
|
53241678
|
|
53124768
|
Question 49 Explanation:
Preorder traversal means (Root, left, right)
Option D:
Let draw binary search tree for the given sequence,
![](https://solutionsadda.in/wp-content/uploads/2020/02/t1-1.jpg)
After traversing through this tree we will get the same sequence.
Option D:
Let draw binary search tree for the given sequence,
![](https://solutionsadda.in/wp-content/uploads/2020/02/t1-1.jpg)
After traversing through this tree we will get the same sequence.
Correct Answer: D
Question 49 Explanation:
Preorder traversal means (Root, left, right)
Option D:
Let draw binary search tree for the given sequence,
![](https://solutionsadda.in/wp-content/uploads/2020/02/t1-1.jpg)
After traversing through this tree we will get the same sequence.
Option D:
Let draw binary search tree for the given sequence,
![](https://solutionsadda.in/wp-content/uploads/2020/02/t1-1.jpg)
After traversing through this tree we will get the same sequence.
Subscribe
Login
0 Comments