Giter Club home page Giter Club logo

bubble-sort's Introduction

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.

bubble-sort's People

Contributors

joseph-burke avatar alaska01 avatar

Stargazers

Cristian Viorel Ceamatu avatar

Watchers

James Cloos avatar  avatar

bubble-sort's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.