What is the main advantage of a hash table (or dictionary) over an unsorted array for element lookup?
👤
ByZain
🌐
Source
Computer Science Knowledge Database
✅
Fact Checked
📊
DifficultyMedium
📅
Published15 Feb 2026
💡 Explanation:
A well-implemented hash table, utilizing a good hash function, offers an average-case time complexity of O(1) for search, insertion, and deletion operations. This near-constant time performance is a significant advantage over an unsorted array, which requires O(n) time for a lookup in the average and worst cases (linear search). Option B is incorrect because the worst-case complexity for a hash table is O(n) due to collisions. Option A is incorrect as hash tables often require extra space for buckets or collision resolution. Option D is incorrect; arrays are better for sequential access.