Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Make a program that sorts an array in ascending order using the the method here:

ID: 3619479 • Letter: M

Question

Make a program that sorts an array in ascending order using the the method here:
int [] a = {15,3,5,17,22,93,18}
1- Compare the first 2 numbers (15,3). Which one is smaller? 3.
The array becomes = {3,15,5,17,22,93,18}

2- Compare the next two numbers (15,5). Which one is smaller? 5.
The array becomes = {3,5,15,17,22,93,18}

3- Continue comparing 2 numbers at a time until you get:
{3,5,15,17,22,18,93}.

4- Notice that the array {3,5,15,17,22,18,93} above is still not sorted.

5- Make the program automatically repeat itself over and over by comparing 2 numbers at a time until you get {3,5,15,17,18,22,93}.

Explanation / Answer

please rate - thanks
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote