Hash = Chopping something up into small pieces.
Map = Taking those pieces and scrambling them into a number.
Kind of like hashing meat into ground beef.
It is probably most useful data structure for coding interviews.
It maps keys to values, allowing us O(1) access, insertion, and deletion.
Here are the topics you must know for coding interviews.
→ Add/Remove Key-Value Pair
→ Check for Key
→ Check for Value
→ Access / Modify Value With Key
→ Iterate over keys, values, or key-value pairs
→ Pair Sum Problems
→ Duplicate Detection
→ Counting
→ Insertion & Hashing
→ Hash Functions
→ Resizing & Rehashing
→ Open Addressing
→ Chaining
The goal of this guide is to help you get up to speed with understanding hash maps and start solving problems
Technically, the O(1) refers to the average case for a hash map. In the worst case, the performance can degrade to O(n)
The hash function is critical to the hash map performing well
From a practical perspective, there are disadvantages to the hash map for smaller input sizes
Hash maps are unordered data structures that store key-value pairs. You should avoid using them when the order must be preserved