From 2d1d836575df08a73d8e5ea628d7864f1906e175 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 9 May 2024 15:51:30 +0200 Subject: [PATCH] update median thing --- libselect/src/normal_select.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);