Skip to content

Commit c3f4ec4

Browse files
authored
Update recipe-576917.py
1 parent 702450d commit c3f4ec4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

recipes/Python/576917_Functional_selection_sort/recipe-576917.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
# Recursive version
2020
def select_sort_r(L):
2121
if not L: return [] # terminal case
22-
idx, v = min(enumerate(L), key=lambda e: e[1]) # select the minimum
22+
v, idx = min((v, i) for i, v in enumerate(L)) # select the smallest
2323
return [v] + select_sort_r(L[:idx] + L[idx+1:]) # recursively call on the remainder

0 commit comments

Comments
 (0)