|
|
|
|
|
by alexhutcheson
2355 days ago
|
|
If you're not interleaving insertions and lookups, then a sorted vector can be really good. If you need to interleave insertions and lookups, but don't need to traverse in sorted order, then a good hash table (not std::unordered_map) is normally the best option. You only need a tree if you need traversal in sorted order and interleaved insertions and lookups, which is pretty uncommon. Even then you are almost always better off with a B-tree than a red-black tree. |
|
[0]: https://neosmart.net/blog/2019/sorted-list-vs-binary-search-...