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

// 2. ***** student writes this method /** Sorts arr in ascending order using th

ID: 3841396 • Letter: #

Question

// 2. ***** student writes this method
/** Sorts arr in ascending order using the bubble sort algorithm
*/
public void bubbleSort()
{

// Note: To animate the algorithm, put this method call as the
// last statement in your innermost for loop
// animate(i, j);
// where i is the value of the outer loop counter
// and j is the value of the inner loop counter,
// or the index of the current array element
// Part 2 student code starts here:

// Part 2 student code ends here.
} // end of bubbleSort

i need someone to make a bubble sort algorithm for this part of my project

Explanation / Answer

Hope you are asking for the Bubble sort algoritham, If you want the code le mt know:

Here is the algoritham for bubble sort alogoritham:

1.function Animation(a:list of items which need to be sort)//it's better to initialize the function like this than to take the variables as i,j

2.n=length(a);
repeat
4.for i=1 to n
5.for j=1 to n-i
6.if(arr[j-1]>arr[j]) then
7.swap (arr[j-1],arr[j])
end if
end for

8.main()
9.entering the values for array;
10.Animation(a:list of items which need to be sorted);//calling the function

If you did not understand anywhere please let me know.