george-shammar / bubble_sort_by

1 stars 0 forks source link

Bubble sort by feature #1

Closed george-shammar closed 3 years ago

george-shammar commented 3 years ago

This Pull Request seeks to merge the content of bubble_sort_by_feature to the main branch.

Below are the descriptions of the feature updates:

  1. The feature contains a defined method, bubble_sort_by based on the bubble_sort model.
  2. The feature is meant to be called on an array.
  3. The algorithm compare two items of an array - arr[i] and arr[i + 1] or left and right as defined by the left and right variable in the code block.
  4. The code block is meant to be executed arr.length.times, representing the number of items in the array.
  5. If arr[i] is greater than arr[i + 1], the two items' positions are to be swapped.
  6. The new method, bubble_sort_by was called on a test array and the array items were sorted.
voscarmv commented 3 years ago

You may refer to this article for more information on how to use the yield method in ruby with multiple input parameters (as required by this project)

https://stackoverflow.com/questions/41865139/ruby-block-taking-array-or-multiple-parameters

I recommend you read it from top to bottom before continuing so you can understand what's going on in your code and how to debug it! If you have any questions feel free to hit me up on Slack. I'm Oscar Mier.

Cheers!