Question 2and 3 pleaseSolutionBubble sort void bubblesortint


Question 2and 3 please

Solution

Bubble sort

void bubblesort(int ar[])

{

for(int i=(ar.length-1);i>=0;i--)

{

for (int j=1;j<=i;j++)

{

if (ar[j-1]>ar[j])

{

int temp=ar[j-1];

ar[j-1]=ar[j];

ar[j]=temp;

}

}

}

}

Selection sort

Insertion sort

Merge sort

Quick sort

Sorting Summary

 Question 2and 3 pleaseSolutionBubble sort void bubblesort(int ar[]) { for(int i=(ar.length-1);i>=0;i--) { for (int j=1;j<=i;j++) { if (ar[j-1]>ar[j])

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site