[libcxx-commits] [PATCH] D144538: Checked that complexity of std::sort_heap is 2N log(N) comparisons

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 1 08:11:54 PST 2023


philnik added inline comments.


================
Comment at: libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp:49
 
 int main(int, char**)
 {
----------------
Could you move this test to `libcxx/test/std` and also add it to `ranges_sort_heap.pass.cpp`?


================
Comment at: libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp:73
 #ifndef _LIBCPP_ENABLE_DEBUG_MODE
-  assert(stats.compared == 1'534'701);
+    assert(stats.compared <= n * logn);
 #endif
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144538/new/

https://reviews.llvm.org/D144538



More information about the libcxx-commits mailing list