-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.14.1
Steps to Reproduce and Observed Behavior
Is there a reason to use std.math.floorPowerOfTwo()
because it basically defeats the whole purpose of the heap sort?
Line 47 in 6808ce2
const max_limit = std.math.floorPowerOfTwo(usize, b - a) + 1; |

Expected Behavior
Usually sorting functions have used something like floor(log2(n)) + 1
, ceil(log2(n + 1))
or 2 * floor(log2(n))
as their limits before switching to heap sort or some other constant time algorithm. This is not a huge issue since even these lower limits are very rarely reached with real world data. Usually you have to put some "adversarial" data to make even relatively simple quick sort algorithms to go quadratic.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior