What is a Binary Search Tree?
A
A binary tree where every node has exactly two children B
A binary tree where left child nodes are less than the parent and right child nodes are greater C
A tree where all nodes are greater than their children D
A tree with nodes connected in a random order
Analysis & Theory
In a BST, left children are < parent, and right children are > parent.
What is the worst-case time complexity to search for a value in a BST?
A
O(1) B
O(log n) C
O(n) D
O(n log n)
Analysis & Theory
In a degenerate (skewed) BST, searching can take O(n) time.
Which traversal of a BST produces the elements in sorted order?
A
Pre-order traversal B
In-order traversal C
Post-order traversal D
Level-order traversal
Analysis & Theory
In-order traversal yields sorted elements in a BST.
What is the time complexity to insert a node in a balanced BST?
A
O(1) B
O(log n) C
O(n) D
O(n log n)
Analysis & Theory
In a balanced BST, insertion takes O(log n) time.
Which of the following statements about BSTs is TRUE?
A
All BSTs are balanced by default B
BSTs allow duplicate elements by default C
Searching in BST is always O(log n) D
The left subtree of a node contains only nodes with keys less than the node’s key
Analysis & Theory
BST property: left subtree keys < node key.
Which operation can unbalance a BST the most?
A
Inserting random values B
Deleting a leaf node C
Inserting sorted values D
Searching for a value
Analysis & Theory
Inserting sorted values can create a skewed tree (degenerate).
What is the height of a perfectly balanced BST with n nodes?
A
O(1) B
O(n) C
O(log n) D
O(n log n)
Analysis & Theory
Height of a balanced BST is O(log n).
Which of these is NOT a self-balancing BST?
A
AVL Tree B
Red-Black Tree C
Splay Tree D
Binary Heap
Analysis & Theory
Binary Heap is not a BST; it is a complete binary tree used for priority queues.
How is the minimum value in a BST found?
A
By traversing all nodes B
By moving to the leftmost node C
By moving to the rightmost node D
By checking the root only
Analysis & Theory
The minimum value is always in the leftmost node.
Which traversal is suitable to delete the tree nodes safely without orphaning children?
A
In-order traversal B
Pre-order traversal C
Post-order traversal D
Level-order traversal
Analysis & Theory
Post-order deletes children before the parent.