What is the space used by programs when we use Hashmap in our program?
2017
What is the space used by programs when we use Hashmap in our program?
Answer: C. O(N) — The space complexity of a HashMap is O(N) because it stores N key-value pairs. Each entry requires constant space, leading to linear total memory usage…
- A.
O(1)
- B.
O(LogN)
- C.
O(N)
- D.
None
Attempted by 985 students.
Show answer & explanation
Correct answer: C
The space complexity of a HashMap is O(N) because it stores N key-value pairs. Each entry requires constant space, leading to linear total memory usage relative to the number of elements.
Explore the full course: Iocl Engineers Officers Grade A Paper 2
Loading lesson…