Skip to content

Latest commit

 

History

History

bubble_sort

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Project: Bubble Sort

From The Odin Project

Build a method #bubble_sort that takes an array and returns a sorted array. It must use the bubble sort methodology (using #sort would be pretty pointless, wouldn’t it?).

Usage

Use the following command to run the application

  • from the root folder:
ruby bubble_sort/bubble_sort.rb

OR

  • from inside the bubble_sort folder
ruby bubble_sort.rb

Examples

Before: [4, 3, 78, 2, 0, 2]
After:  [0, 2, 2, 3, 4, 78]
Before: [1, 2, 3, 4, 5]
After:  [1, 2, 3, 4, 5]
Before: [2, 3, 4, 5, 1]
After:  [1, 2, 3, 4, 5]