From 1f65007456bc48b90f6183b851c5b9f60fb52ae6 Mon Sep 17 00:00:00 2001 From: jbaenaxd Date: Sun, 1 Nov 2020 08:38:11 +0100 Subject: [PATCH] Shortened code (#3855) --- searches/quick_select.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/searches/quick_select.py b/searches/quick_select.py index 17dca39..5ede8c4 100644 --- a/searches/quick_select.py +++ b/searches/quick_select.py @@ -44,8 +44,7 @@ def quick_select(items: list, index: int): if index >= len(items) or index < 0: return None - pivot = random.randint(0, len(items) - 1) - pivot = items[pivot] + pivot = items[random.randint(0, len(items) - 1)] count = 0 smaller, equal, larger = _partition(items, pivot) count = len(equal) -- GitLab