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, so range queries require checking all elements, making them inefficient compared to BSTs which can quickly find 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) average time; Hash Map: O(1) average time for search.
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 keys, values, and handling collisions, while BSTs use memory mainly for nodes and pointers.
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) search, which do not maintain 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 time complexity of searching in a Hash Map?
✗ Incorrect
Hash Maps provide average O(1) time for search due to direct key access.
Which data structure is better for efficient range queries?
✗ Incorrect
BSTs maintain order, allowing efficient range queries via traversal.
What is a downside of using a Hash Map compared to a BST?
✗ Incorrect
Hash Maps do not keep elements ordered, making ordered operations inefficient.
Which data structure typically uses more memory due to 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 query types.
You got /6 concepts.
Describe scenarios where a Binary Search Tree is preferred over a Hash Map.
Consider operations that depend on data order.
You got /4 concepts.