Here we will be constructing our own bubble sort.
Using the sort()
method, write in your logic for bubble sorting a series of integers.
The method will be provided an unsorted array of integers as a parameter.
What should be returned is an array in ascending order.
Ex:
input -> [3,2,5,1,4]
output -> [1,2,3,4,5]
Be sure to be mindful of the array indices as ArrayIndexOutOfBoundsExceptionsare
very common.
The lab comes with tests that will verify the correct functionality. You can look at the test code to get a better sense of what the lab expects located in src/test/java/BubbleSortTest.java
.
To run the tests, use Maven via your shell with mvn test
or in your IDE. The Run button on Replit should also run your tests.
If you have any issues, try running mvn dependency:resolve
and then running the tests again.
If that doesn't work, let [email protected] know and do your best without the tests.
You can also fork and clone this lab on GitHub and submit a pull request when you're done.