Which of the following traversal outputs the data in sorted order in a BST? a) P
ID: 3906705 • Letter: W
Question
Which of the following traversal outputs the data in sorted order in a BST? a) Preorder b) Inorder c) Postorder d) Level order 4) 5) The following numbers are inserted into an empty binary search tree in the given order: 10, 1,3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)? a) 2 Consider the following binary search tree T given below: Which node contains the fourth smallest element in T? a) Q b)V c) W d)X What is common in three different types of traversals (Inorder, Preorder and Postorder)? a) 7) b) c) d) Root is visited before right subtree Root is visited after left subtree Left subtree is always visited before right subtree All of the above Date: 11thExplanation / Answer
4) Level order traversal will give nodes in sorted order in BST.
In level order we will traverse thr nodes level by level thats why it will gibe nodes in dorted order.
5)4 is the height the path is 10->1->3->5 left sub tree
6)w is the node which contains fourth smallest element.
As we know level order traversal gives nodes in a sorted order in BST the level order traversal for above tree is
P,Q,V,
7) option C. Left sub tree is visited before the right sub tree.
8)counts no of internal nodes. For each recursive call we are adding 1 so ut will return count of internal nodes.
9)option a. SQPTRWUV
10)B has same inorder and A,C,D has same preorder
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.