News for hackers. Stuff that matters.
Re:Branchless Lomuto Partitioning by kazinator on Wednesday December 06, 2023 @08:22PM (#38551716)
Another problem is that if you have an array of identical values, Hoare contrived things so that his two partitioning pointers meet in the middle, ensuring O(n log n) behavior. Lomuto produces a degenerate partition, resulting in the quadratic worst case.
Re:Branchless Lomuto Partitioning by orlp on Thursday December 07, 2023 @02:20AM (#38553765)
My algorithm pdqsort fixes this problem fundamentally which turns many identical values into an ideal O(n log k) case where k is the number of unique values, even if it were to use Lomuto.