This project focuses on the bubble sort algorithm. This algorithm allows the user to input or pass an array and get that sorted in ascending order.
-
In case of integers this algorithm simply calculates which integer is bigger and swaps if need from each other to sort them. For example: 4 and 2. So, 4 would be greater than 2 and come after it. Expected result: 2, 4
-
In case of strings in an array this algorithm calculates the length of an array and then sorts them accordingly. For example: "hello" has a length of 5 and "hi" has a length of 2. So, "hello" would be greater than "hi" and come after it. Expected result: "hi","hello"
- Ruby
👤 Rockebell
- Twitter: @twitterhandle
- LinkedIn: LinkedIn
- GitHub: @githubhandle
👤 Uzair
- LinkedIn: LinkedIn
- GitHub: @githubhandle
To get a local copy of this project follow the steps below:
Use git clone https://github.com/uzairali19/bubble-sort.git
to clone the branch directly to your machine
- Run
bundle install
. - Run
rubocop
. - Fix linter errors.
- IMPORTANT NOTE: feel free to research auto-correct options for Rubocop if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code!
- Navigate the project, you can open it with VScode or any other code editor of choice
- run the code by opening up your terminal and typing
ruby bubble_sort.rb
- Happy coding!
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
This project is copyright protected, Feel free to contact the authors to collaborate.