1 parent a538989 commit 1f65007Copy full SHA for 1f65007
1 file changed
searches/quick_select.py
@@ -44,8 +44,7 @@ def quick_select(items: list, index: int):
44
if index >= len(items) or index < 0:
45
return None
46
47
- pivot = random.randint(0, len(items) - 1)
48
- pivot = items[pivot]
+ pivot = items[random.randint(0, len(items) - 1)]
49
count = 0
50
smaller, equal, larger = _partition(items, pivot)
51
count = len(equal)
0 commit comments