SortAO
Your TypeScript ordered container suite, also supports switching the underlying container on demand.
Easy to use
SortAO provides 4 advanced wrappers out of the box.
- Sorted-Map:Ordered dictionary, with unique keys.
- Sorted-Set:An ordered set, with unique values.
- Sorted-Multimap:An ordered dictionary, allows duplicate keys.
- Sorted-Multiset:An ordered multiset, allowing repeated values.
Flexible and efficient
These wrappers can replace the underlying containers! You can choose the most suitable engine based on the access pattern of your business.
It is worth noting that these kernel containers can be used independently, providing more low-level access control and facilitating optimization.
| Container | Features | Query by ranking | Insert |
|---|---|---|---|
| Balanced overall performance, memory-friendly, default option. | O(log N) | O(B + N/B) | |
| The query efficiency is consistent with that of native arrays. | O(1) | O(B + N/B) | |
| The operation near the extreme values at both ends is highly efficient. | O(1) | O(B + N/B) | |
| Automatically optimize local hot data. | O(log N) * | O(log N) * |