Skip to content

Commit 1f65007

Browse files
authored
Shortened code (TheAlgorithms#3855)
1 parent a538989 commit 1f65007

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

searches/quick_select.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def quick_select(items: list, index: int):
4444
if index >= len(items) or index < 0:
4545
return None
4646

47-
pivot = random.randint(0, len(items) - 1)
48-
pivot = items[pivot]
47+
pivot = items[random.randint(0, len(items) - 1)]
4948
count = 0
5049
smaller, equal, larger = _partition(items, pivot)
5150
count = len(equal)

0 commit comments

Comments
 (0)