4 ms·
Tangentially related: C++ does have algorithmic complexity guarantees. For instance, std::unordered_map at() and operator[] are guaranteed to be average case co
by nwallin 7y ago
Tangentially related: C++ does have algorithmic complexity guarantees. For instance, std::unordered_map at() and operator[] are guaranteed to be average case complexity of O(1), and std::nth_element is guaranteed to be average case O(n).
- steerablesafe 7y agoComplexity guarantees for algorithms are often expressed explicitly in numbers of operations, not time [1]. Edit: actually, nth_element is a great example here: https://eel.is/c++draft/alg.nth.element#5 https://eel.is/c++draft/alg.nth.element#5 The complexity requirements for container member functions are often more vague an implicit, but I believe those are also not expressed in terms of time either. It's some other implicitly implied operation. In [2] for example this operation is the construction of a single object. [1] https://eel.is/c++draft/sort#5 https://eel.is/c++draft/sort#5 [2] https://eel.is/c++draft/sequences#vector.cons-5 https://eel.is/c++draft/sequences#vector.cons-5 An other tangentially related part of C++ is <chrono>, but I do not think that there are strict requirements there for precision. At most there is monotonic requirement for steady_clock[3]. [3] https://en.cppreference.com/w/cpp/chrono/steady_clock https://en.cppreference.com/w/cpp/chrono/steady_clock