Permalink
Browse files

fixes #1699

  • Loading branch information...
1 parent 4419f7c commit 94a9551ffa696b0d6d3fd4e7c6aa8a2fc0c043c3 @michaelficarra michaelficarra committed Sep 18, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 examples/computer_science/selection_sort.coffee
@@ -9,7 +9,7 @@ selection_sort = (list) ->
min = i
# 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.
[list[i], list[min]] = [list[min], list[i]] if i isnt min

0 comments on commit 94a9551

Please sign in to comment.