Merge branch 'master' of github.com:jashkenas/coffee-script
This commit is contained in:
commit
6da70168a6
|
@ -9,7 +9,7 @@ selection_sort = (list) ->
|
||||||
min = i
|
min = i
|
||||||
|
|
||||||
# Check the rest of the array to see if anything is smaller.
|
# Check the rest of the array to see if anything is smaller.
|
||||||
min = j if list[j] < list[min] for j in [i + 1...len]
|
min = k for v, k in list[i+1...] when v < list[min]
|
||||||
|
|
||||||
# Swap if a smaller item has been found.
|
# Swap if a smaller item has been found.
|
||||||
[list[i], list[min]] = [list[min], list[i]] if i isnt min
|
[list[i], list[min]] = [list[min], list[i]] if i isnt min
|
||||||
|
|
Loading…
Reference in New Issue