Find a file
2016-08-16 20:05:33 +05:30
BogoSort.rb Create BogoSort.rb 2016-08-12 22:11:35 +05:30
BubbleSort.rb Added Bubble Sort 2016-07-25 23:03:27 +05:30
InsertionSort.rb Insertion Sort Ruby 2016-07-26 23:46:43 +05:30
README.md Updated Readme 2016-08-16 20:05:33 +05:30

The Algorithms - Ruby

All algorithms implemented in Ruby (for education)

These are for demonstration purposes only.

Sorting Algorithms

Bogo Sort

Add comments here

Bubble Sort

alt text

From Wikipedia: Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

Properties

  • Worst case performance O(n^2)
  • Best case performance O(n)
  • Average case performance O(n^2)
View the algorithm in action

Insertion Sort

alt text

From Wikipedia: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.

Properties

  • Worst case performance O(n^2)
  • Best case performance O(n)
  • Average case performance O(n^2)
View the algorithm in action