gerben-s / quicksort-blog-post

https://blog.reverberate.org/2020/05/29/hoares-rebuttal-bubble-sorts-comeback.html
Apache License 2.0
39 stars 7 forks source link

Comparison object is not used in BubbleSort2 #3

Closed andyg24 closed 3 years ago

andyg24 commented 3 years ago

Hi,

Since you've tried to make this algorithm general, in BubbleSort2, the line

if (y < x) std::swap(x, y);

should be

if (comp(y, x)) std::swap(x, y);

Thanks.

gerben-s commented 3 years ago

Thanks for the spot! fixed in https://github.com/gerben-s/quicksort-blog-post/commit/06f629814e469be974ee1827754ff49eb0f1fba0