Binary Search Tree MCQ Quiz in తెలుగు - Objective Question with Answer for Binary Search Tree - ముఫ్త్ [PDF] డౌన్లోడ్ కరెన్
Last updated on Mar 13, 2025
Latest Binary Search Tree MCQ Objective Questions
Top Binary Search Tree MCQ Objective Questions
Binary Search Tree Question 1:
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?
Answer (Detailed Solution Below)
Binary Search Tree Question 1 Detailed Solution
The correct answer is option 1
Concept:
A binary search tree (BST) is a node-based binary tree data structure and it follows the following points
- Left sub-tree nodes key value will exist only if lesser than the parent node key value.
- Right sub-tree nodes key value will exist only if greater than the parent node key value.
- Left sub-tree and Right sub-tree must be a Binary search tree.
Explanation:
Step 1: First 10 comes and now that is the Root node.
Step 2: Now 1 came and 1 < 10 then insert Node 1 to the Left of Node 10.
Step 3: Now 3 came and 3 < 10 go to the Left of
Node 10 and check 3 > 1 then insert Node 3 to the Right of Node 1.
Step 4: Now 5 came and 5 < 10 go to the Left of
Node 10 and check 5 > 1 go to the Right of Node 1 then check 5 > 3 then insert Node 5 to the Right of Node 3.
Step 5: Now 15 came and 15 > 10 then insert Node 15 to the Right of Node 10.
Step 6: Now 12 came and 12 > 10 go to the Right of Node 10 and check 15 > 12 then insert Node 12 to the Left of Node 15.
Step 7: Now 16 came and 16 > 10 go to the Right of
10 and check 16 > 15 then insert 16 to the Right of Node 15.
After step 7, we can count the height of the tree as 3.
Important Points
Follow the longest path in the tree and count the edges that are height.
Tips To Learn:
Left sub-tree(key)<Node(key)<Right sub-tree(key)
Node(key): Parent node of Left sub-tree and Right sub-tree
Binary Search Tree Question 2:
We create a binary search tree B1 by inserting the numbers 1, 2, 3, 4, 5 into an empty binary search tree. We create another binary search tree B2 by inserting the numbers into an empty binary search tree in the reverse order. What is the difference between the right-most element of B1 and the left-most element of B2?
Answer (Detailed Solution Below)
Binary Search Tree Question 2 Detailed Solution
The correct answer is option 3.
Concept:
A binary search tree, also known as an ordered or sorted binary tree is a rooted binary tree data structure in which each internal node stores a key that is higher than all keys in the node's left subtree but less than those in the node's right subtree.
right-most element of B1= 5
left-most element of B2 = 1
Difference between both B1-B2=5-1=4.
Hence the correct answer is 4.
Binary Search Tree Question 3:
The worst case complexity for searching an element in binary search tree is:
Answer (Detailed Solution Below)
Binary Search Tree Question 3 Detailed Solution
Concept:
In Binary search tree, searching of a given element depends on height of BST.
Explanation:
The height of BST in the Worst case is n -1
Worst case time complexity = T(n) = O(n)
Binary Search Tree Question 4:
Consider a list of integer 45,65,35,40,33,70,60,75,69 inserted in a binary search tree with same sequence. What is the height of the tree if the height of a single node is 0?
Answer (Detailed Solution Below)
Binary Search Tree Question 4 Detailed Solution
Concept:
In binary search tree
- Left sub tree (LST) of every node should contains only nodes with key value less than the node’s key
- Right sub tree (RST ) of every node should contains only nodes with key values greater or equal than the node’s key
Explanation:
BST tree after inserting all the nodes ( values )
Therefore height of tree is 3
Binary Search Tree Question 5:
Create a binary search tree B1 by inserting the numbers 1, 2, 3, ... n into an empty binary search tree. Create another binary search tree B2 by inserting the numbers into an empty binary search tree in the reverse order. What is the difference between the right-most element of B1 and the left-most element of B2?
Answer (Detailed Solution Below)
Binary Search Tree Question 5 Detailed Solution
Concept:
The right subtree of a node contains only nodes with values greater than or equal to the node’s value.
The left subtree of a node contains only nodes with values less than the node’s value.
Explanation: Take n = 5
B1:
B2:
n = 5
∴ Difference = 5 - 1 = n- 1
Therefore option 2 is correct
Binary Search Tree Question 6:
The following is the sequence of insertion in a binary search tree.
45,65,35,40,33,70,60,75,69
How many numbers of nodes in Left Sub Tree (LST) and Right Sub Tree (RST) of Root node.Answer (Detailed Solution Below)
Binary Search Tree Question 6 Detailed Solution
Concept:
In binary search tree
- Left sub tree (LST) of every node should contains only nodes with key value less than the node’s key
- Right sub tree (RST ) of every node should contains only nodes with key values greater or equal than the node’s key
Explanation:
BST tree after inserting all the nodes ( values )
∴ LST = 3 and RST = 5
Binary Search Tree Question 7:
Which of the following statements about the following binary tree is FALSE?
Answer (Detailed Solution Below)
Binary Search Tree Question 7 Detailed Solution
Concept:
Binary search tree: A BST is a tree in which all the nodes follow the two properties.
1) The left sub tree of a node has a key less than or equal to its parent node’s key.
2) The right sub tree of a node has a key greater than its parent’s key.
Complete binary tree: A complete binary tree is a binary tree in which every level except possibly the last level is completely filled and all nodes are as left as possible.
Explanation:
In this tree, it is clearly showing that node J and K are siblings.
Also, given tree is satisfying the property of a complete binary tree.
But it is not following the property of binary search tree. So, option 3) it is a binary search tree is incorrect here.Binary Search Tree Question 8:
A binary search tree is generated by inserting in order of the following data: 17, 18, 10, 1, 20, 25, 4, 9, 13, 15, 6, 21, 24, 16. The number of nodes in the left subtree and right subtree of the root respectively is
Answer (Detailed Solution Below)
Binary Search Tree Question 8 Detailed Solution
17 is the root element: 8 elements are to the left of root and 5 elements are to the right of the root
∴ (8, 5) is the correct answer.
Tips and Tricks:
Since it is a binary search tree sort the element and count the element to the left of root and to the right of root where 17 is the root element
Binary Search Tree Question 9:
When searching for the key value 50 in a binary search tree, nodes containing the key values 10, 15, 20, 30, 60, 80, 89, 90 are traversed, not necessarily in the given order. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value 50?
Answer (Detailed Solution Below) 70
Binary Search Tree Question 9 Detailed Solution
In binary search tree, when searching for the key value 50, elements 10, 15, 20 and 30 will be on left side and 60, 80, 89 and 90 will be on the right side.
Number of ways = Number of possible permutations of 8 numbers/(Number of possible permutations less than 50* Number of possible permutations greater than 50)
Therefore, number of ways = \(8! \over (4!*4!) \) = 70
Binary Search Tree Question 10:
What will be post order traversal of a binary Tree T, if preorder and inorder traversals of T are given by ABCDEF and BADCFE respectively?
Answer (Detailed Solution Below)
Binary Search Tree Question 10 Detailed Solution
The correct answer is option 4.
Concept:
The given data,
preorder = ABCDEF
In order = BADCFE
Tree traversal | |||
Method Sequence | Inorder | Preorder | Postorder |
Left Sub-tree | Root | Left Sub-tree | |
Root | Left Sub-tree | Right Sub-tree | |
Right Sub-tree | Right Sub-tree | Root |
The binary tree for the traversal is,
Post order for the above tree is,
BDFECA
Hence the correct answer is BDFECA.