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 screenshot

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
  • 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/cristianCeamatu/microverse-bubble-sort.git

  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

👤 Cristian Viorel Ceamatu

👤Muhammed Cihad Kurel

🤝 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 has no license