DSModule 4 Quiz 4
DSModule 4 Quiz 4
3. What is the time complexity of searching for an element in a balanced binary search tree (BST)?
A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)
4. In a pre-order traversal of a binary tree, the nodes are visited in which order?
A) Left subtree, right subtree, root
B) Root, left subtree, right subtree
C) Left subtree, root, right subtree
D) Right subtree, left subtree, root
6. In an AVL tree, the height difference between the left and right subtrees of any node should not
exceed:
A) 0
B) 1
C) 2
D) 3
8. Which tree operation is primarily used in a Splay Tree to bring a frequently accessed node to the
root?
A) Rotation
B) Splaying
C) Balancing
D) Deletion
9. Which of the following traversal methods is also known as Depth-First Search (DFS)?
A) Pre-order traversal
B) In-order traversal
C) Post-order traversal
D) Level-order traversal
10. In a binary search tree (BST), what is the worst-case time complexity for inserting an element if
the tree is skewed?
A) O(log n)
B) O(n)
C) O(1)
D) O(n log n)