Method: Algorithmable::Sort::Utils#swap
- Defined in:
- lib/algorithmable/sort/utils.rb
#swap(collection, i) ⇒ Array
Returns collection.
58 59 60 61 62 63 |
# File 'lib/algorithmable/sort/utils.rb', line 58 def swap(collection, i) current = collection[i] collection[i] = collection[i + 1] collection[i + 1] = current collection end |