Treemap
TreeMap is a collection that stores sorted key-value pairs (Map)
- Just like TreeSet (Java), it’s based on a Red Black Tree (balanced BST),
- This structure keeps operations efficient (
O(log n)
) and ensures elements remain sorted automatically.
- This structure keeps operations efficient (