diff --git a/libselect/src/normal_select.rs b/libselect/src/normal_select.rs index 428ffe3..ae5912c 100644 --- a/libselect/src/normal_select.rs +++ b/libselect/src/normal_select.rs @@ -79,7 +79,7 @@ impl NormalSelect { for i in (lo..=hi).step_by(k) { if i + (k - 1) <= hi { self.insertion_sort(list, i, i + (k - 1)); - medians[index] = list[i + 2]; + medians[index] = list[i + (k / 2)]; index += 1; } else { self.insertion_sort(list, i, hi);