mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-30 06:03:42 +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…
Reference in New Issue
Block a user