mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-19 21:19:47 +00:00
Shortened code (#3855)
This commit is contained in:
parent
a538989939
commit
1f65007456
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user