Commit graph

9 commits

Author SHA1 Message Date
Ahmet Inan
cf60e38b9d we ain't come this far to omit sorting 2024-03-11 10:48:56 +01:00
Ahmet Inan
c86f767cac use median of five
Median5 algorithm taken from:

Fast Deterministic Selection
by Andrei Alexandrescu - 2016
2024-03-11 09:17:21 +01:00
Ahmet Inan
c9bc0ffad8 simplified select function 2024-03-10 22:43:36 +01:00
Ahmet Inan
1150d77a27 use three-way partitioning to improve equal keys performance 2024-03-10 12:23:16 +01:00
Ahmet Inan
7d6418220e use median of three to increase our chances 2024-03-09 20:49:52 +01:00
Ahmet Inan
b0c9bc7d41 got rid of the recursion 2024-03-09 18:57:47 +01:00
Ahmet Inan
eb968e50b6 choose the middle value as pivot 2024-03-09 18:37:19 +01:00
Ahmet Inan
6013451ee2 added asserts for k and n 2024-03-09 17:55:32 +01:00
Ahmet Inan
9646da13e1 added quick select algorithm 2024-03-09 14:58:13 +01:00