We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 702450d commit c3f4ec4Copy full SHA for c3f4ec4
1 file changed
recipes/Python/576917_Functional_selection_sort/recipe-576917.py
@@ -19,5 +19,5 @@
19
# Recursive version
20
def select_sort_r(L):
21
if not L: return [] # terminal case
22
- idx, v = min(enumerate(L), key=lambda e: e[1]) # select the minimum
+ v, idx = min((v, i) for i, v in enumerate(L)) # select the smallest
23
return [v] + select_sort_r(L[:idx] + L[idx+1:]) # recursively call on the remainder
0 commit comments