curly implements same sorted containers which respectively compatible with std::map
, std::multimap
, std::set
and std::multiset
.
The difference between these containers and containers of STL is iterator of
these containers is 'random access'(not completely, because which isn't satisfying O(1) random access, but O(lg n)).
Following figure is benchmark result of insert
, erase
, copy
, std::distance
and std::advance
between different set container
Time complexity comparison between std::set
, curly::pset
and curly::set2
Operation | std::set |
curly::set2 |
curly::pset |
---|---|---|---|
insert | O(lg n) | O(lg n) | O(lg n) |
erase | O(lg n), amortized O(n) | O(lg n) | O(lg n), amortized O(n) |
copy assignment | O(n) | O(n) | O(n) |
std::distance | O(n) | O(lg n) | O(n) |
std::advance(iter, k) | O(k) | O(lg n) | O(k) |
just include rbtree.hpp
STL container | curly container | curly container without random access iterator |
---|---|---|
std::set |
curly::pset |
curly::set2 |
std::multiset |
curly::pmultiset |
curly::multiset2 |
std::map |
curly::pmap |
curly::map2 |
std::multimap |
curly::pmultimap |
curly::multimap2 |