Ruby implementations of several sorting algorithms .
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Sorting With Ruby

Welcome! As a budding Rubyist, I wanted to work on my Ruby chops and dive into algorithms. I noticed a dearth of well-documented Ruby examples, so I made some myself. Hopefully this will be helpful to someone looking to get started in sorting algorithms and/or Ruby. I am aware there is a sort method, but like most things I wanted to pick it apart and see how it worked. I'd love feedback on some more clever ways to do these.

Mike August 2011

Algorithms to Include:

  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort (coming soon)
  4. Quick Sort (coming soon)

Selection Sort

"A selection sort finds the minimum value, swaps it with the value in the first position, and repeats these steps for the remainder of the list."

Bubble Sort

Ruby implementation of the infamously inefficient "Bubble Sort"

Sorting Algorithms - Bubble Sort (now with hot animated sorting action)

  • Added the ability to stop once the array is sorted, rather than stepping through every set of elements all the time. Cleaned it up with methods and a Class. Commented the line to see each iteration printed out.

======= 8/17/11 - Bubble Sort v1.0


Mike Manewitz