mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-06 22:05:54 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
177954960c
commit
cbfb0480d9
@ -16,6 +16,7 @@ Examples:
|
|||||||
[98, 34, -1, -2, -42]
|
[98, 34, -1, -2, -42]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def reverse_selection_sort(collection: list) -> list:
|
def reverse_selection_sort(collection: list) -> list:
|
||||||
"""
|
"""
|
||||||
A pure implementation of reverse selection sort algorithm in Python.
|
A pure implementation of reverse selection sort algorithm in Python.
|
||||||
@ -32,7 +33,7 @@ def reverse_selection_sort(collection: list) -> list:
|
|||||||
max_idx = j
|
max_idx = j
|
||||||
|
|
||||||
# Reverse the subarray from the current position to the end
|
# Reverse the subarray from the current position to the end
|
||||||
collection[i:max_idx+1] = reversed(collection[i:max_idx+1])
|
collection[i : max_idx + 1] = reversed(collection[i : max_idx + 1])
|
||||||
|
|
||||||
return collection
|
return collection
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user