Recall & Review
beginner
What is a key advantage of a Binary Search Tree (BST) over a Hash Map when working with ordered data?
A BST maintains elements in sorted order, allowing efficient in-order traversal to access data in ascending or descending order.
Click to reveal answer
intermediate
Why might a Hash Map be less suitable than a BST for range queries?
Hash Maps do not maintain any order of keys, so range queries require checking all keys, which is inefficient compared to BSTs that can quickly navigate ranges.
Click to reveal answer
beginner
What is the average time complexity for search operations in a balanced BST and in a Hash Map?
Balanced BST: O(log n) due to tree height; Hash Map: O(1) average due to direct indexing via hash functions.
Click to reveal answer
intermediate
How does memory usage typically compare between BSTs and Hash Maps?
Hash Maps often use more memory due to storing hash buckets and handling collisions, while BSTs use memory proportional to nodes with pointers only.
Click to reveal answer
advanced
What is a major trade-off when choosing a BST over a Hash Map for data storage?
BSTs provide ordered data and efficient range queries but have slower average search times (O(log n)) compared to Hash Maps' O(1) average search time, which lack order.
Click to reveal answer
Which data structure maintains elements in sorted order by default?
✗ Incorrect
Binary Search Trees keep elements sorted, enabling ordered traversal.
What is the average search time complexity of a Hash Map?
✗ Incorrect
Hash Maps provide average O(1) search time using hashing.
Which data structure is better for efficient range queries?
✗ Incorrect
BSTs allow efficient range queries due to their sorted structure.
What is a downside of using a Hash Map compared to a BST?
✗ Incorrect
Hash Maps do not maintain any order of keys.
Which data structure typically uses more memory due to buckets and collision handling?
✗ Incorrect
Hash Maps use extra memory for buckets and collision resolution.
Explain the main trade-offs between using a Binary Search Tree and a Hash Map for storing ordered data.
Think about order, search speed, and memory.
You got /6 concepts.
Describe scenarios where a Binary Search Tree is preferred over a Hash Map.
Focus on order and query types.
You got /4 concepts.