hanchenye-llvm-project/libcxx/test/algorithms/alg.sorting
David Majnemer 8b51260274 Fix std::make_heap's worst case time complexity
std::make_heap is currently implemented by iteratively applying a
siftup-type algorithm.  Since sift-up is O(ln n), this gives
std::make_heap a worst case time complexity of O(n ln n).

The C++ standard mandates that std::make_heap make no more than O(3n)
comparisons, this makes our std::make_heap out of spec.

Fix this by introducing an implementation of __sift_down and switch
std::make_heap to create the heap using it.
This gives std::make_heap linear time complexity in the worst case.

This fixes PR20161.

llvm-svn: 213615
2014-07-22 06:07:09 +00:00
..
alg.binary.search
alg.heap.operations Fix std::make_heap's worst case time complexity 2014-07-22 06:07:09 +00:00
alg.lex.comparison Fix bug 19840, where some tests were not testing what we wanted. Thanks to Eric for the bug report 2014-05-23 15:30:23 +00:00
alg.merge
alg.min.max fix typo 2014-05-29 14:58:38 +00:00
alg.nth.element
alg.permutation.generators
alg.set.operations
alg.sort
nothing_to_do.pass.cpp