Skip to content

A repository for work related to the first project in Microverse's Ruby module: Bubble Sort

Notifications You must be signed in to change notification settings

Joseph-Burke/Bubble-Sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bubble Sort

For this project, we created two sorting algorithms that use the bubble sort method.

This side-by-side comparative method is seen in the GIF image below.

image

screenshot

The first bubble sort method sorts an array of integers by value, comparing adjacent values with the <=> "spaceship" operator.

The second bubble sort method sorts an array of strings by the length of each element using the "yield" keyword and a code block.

Note: The first algorithm exits once an iteration is passed without any swaps made, signalling that the array is completely sorted. The second algorithm iterates the maximum possible number times (array.length - 1) before exiting. While both methods are suitable for the purposes of this project, it should be noted the first method is better practice in that it does not run code unnecessarily.

Built With

  • Ruby
  • VSCode & Atom
  • Rubocop

Live Demo

To quickly see our project in action, visit the live demo on repl.it.

Getting Started

Prerequisites

To get this project up and running, you must already have ruby installed on your computer.

Installation

To get this project set up on your local machine, follow these simple steps:

  1. Open Terminal.

  2. Navigate to your desired location to download the contents of this repository.

  3. Copy and paste the following code into the Terminal:

    git clone https://github.com/Joseph-Burke/Bubble-Sort

  4. Hit enter.

  5. Once the repository has been cloned, navigate inside the repository and type:

    ruby main.rb

    This will run the code, printing the output of our tests to the terminal.

  6. To change those tests, simply open main.rb in a code editor and modify the values stored in the test_array and test_run variables.

  7. Enjoy sorted arrays of data for the rest of your life.

Authors

👤 Joseph Burke

👤 Aye Daniel

🤝 Contributing

The best way you can contribute to this project is by submitting an issue to help us improve it!

Show your support

If you've read this far, you must like the project! Give us a ⭐️!

Acknowledgments

  • This Project was part of an assignment available on The Odin Project.
  • Our thanks to Microverse and all our peers and colleagues there.

📝 License

This project is MIT licensed.

About

A repository for work related to the first project in Microverse's Ruby module: Bubble Sort

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages