A key step in many sorting algorithms (including selection sort) is swapping the location of two items in an array. Here’s a
swap function that looks like it might work, but doesn’t:
-the code prints out
[9, 9, 4] when it should print out
[9, 7, 4].
I actually rewrote it in Ruby first since I’m more used in thinking in Ruby now (I guess that’s a good thing?)