juniorHash Tables
What is the time complexity of a Hash Table?
Updated Apr 28, 2026
Short answer
Average case is O(1) for search, insert, and delete; Worst case is O(n).
Deep explanation
Hash tables are fundamental for fast lookups. Average case is O(1) for search, insert, and delete; Worst case is O(n). By using a mathematical transformation, they bypass linear scanning required by arrays.
Real-world example
A dictionary or phonebook lookup.
Common mistakes
- Assuming hash tables are always O(1) without considering collision frequency.
Follow-up questions
- What happens if the table is too full?