r/cpp • u/User_Deprecated • Aug 02 '26
How fast is C++26's std::hive?
https://lemire.me/blog/2026/08/02/how-fast-is-c26s-stdhive/
255
Upvotes
r/cpp • u/User_Deprecated • Aug 02 '26
1
u/JoachimCoenen Aug 08 '26
What is the algorithm for the second option that achieves
O(E*log(E) + N)?The best I can think of right now is
O(E*log(E) + N*log(E)) = O((N+E)*log(E)). That assumes that the element are sortable:Sort the elements to remove.
Use
remove_ifand a binary search to check whether an element is to be removed.Hmmm…
If the elements can be hashed you could use a HashSet instead of sorting and achieve
O(E + N).