From bc330397eac932a56152bd2f43cc183b7152fe95 Mon Sep 17 00:00:00 2001 From: Benjamin Lehmann Date: Tue, 12 Jan 2021 18:11:38 -0700 Subject: [PATCH] Add warning about heapsort implementation --- src/Numerics/Sorting.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Numerics/Sorting.cs b/src/Numerics/Sorting.cs index b57b7063..f69dc3e6 100644 --- a/src/Numerics/Sorting.cs +++ b/src/Numerics/Sorting.cs @@ -496,6 +496,9 @@ namespace MathNet.Numerics } else if (recursions > max_recursion_depth) // Heapsort is guaranteed O(n log n) { + // NOTE, there is something wrong with this heapsort implementation. I don't know what, but this fails when the max recursion depth is set too low. + + BuildMaxHeap(keys, satelliteData, comparer, left, right); int heapBoundary = right;