Multimap is a data structure that stores key-value pairs where each key can map to multiple values, unlike regular maps which enforce one value per key.
Key Characteristics:
Applications: Inverted indexing, grouping data by category, multi-valued attributes, and database queries.
Strengths:
Limitations:
| Operation | Average Time | Worst Time | Space |
|---|---|---|---|
| Add Value | O(1) | O(n) | O(1) |
| Remove Value | O(m) | O(n) | O(1) |
| Search Key | O(1) | O(n) | O(1) |
| Remove All | O(m) | O(n) | O(1) |
| Space | - | - | O(n+m) |
n = number of keys, m = total number of values