Recall & Review
beginner
What is the average time complexity for lookup in a Hash Map?
The average time complexity for lookup in a Hash Map is O(1), meaning it can find an element very quickly using a key.
Click to reveal answer
beginner
How does lookup work in an Array?
Lookup in an Array is O(1) if you know the index because you can directly access the element. But if you search by value, it is O(n) because you may need to check each element.
Click to reveal answer
beginner
Why is lookup in a Linked List slower than in an Array or Hash Map?
Lookup in a Linked List is O(n) because you must start at the head and check each node one by one until you find the target.
Click to reveal answer
intermediate
What is a key advantage of using a Hash Map over an Array or Linked List for lookup?
A Hash Map provides fast lookup by key with average O(1) time, which is much faster than searching through an Array or Linked List when you don't know the index.
Click to reveal answer
intermediate
When might you prefer using an Array over a Hash Map or Linked List for lookup?
You might prefer an Array when you need fast access by index and the data size is fixed or small, because Arrays use less memory and have simple structure.
Click to reveal answer
What is the average time complexity of lookup in a Hash Map?
✗ Incorrect
Hash Maps use keys to directly access values, making average lookup time O(1).
If you want to find a value in an unsorted Array by searching each element, what is the time complexity?
✗ Incorrect
You may need to check each element, so the time is O(n).
Which data structure requires checking nodes one by one for lookup?
✗ Incorrect
Linked Lists store elements in nodes connected by pointers, so you check nodes one by one.
Which data structure provides fastest lookup by index?
✗ Incorrect
Arrays allow direct access by index in O(1) time.
When is a Hash Map less efficient than an Array for lookup?
✗ Incorrect
If you know the index, Array lookup is faster and simpler than Hash Map.
Explain the differences in lookup time complexity between Hash Map, Array, and Linked List.
Think about how each data structure accesses elements.
You got /3 concepts.
Describe scenarios where you would choose an Array, Linked List, or Hash Map for lookup operations.
Consider speed and type of access needed.
You got /3 concepts.
