Question: Help!!! Need pseudo code or flowchart for the following program. Due soon!! Code works fine, no help with it. *Attached is a description of the
Help!!! Need pseudo code or flowchart for the following program. Due soon!! Code works fine, no help with it. *Attached is a description of the problem*
public class JavaSort {
private int[] arr=new int[13];
public void BubbleSort(int[] a){
int c,d,temp;
for (c = 0; c
for (d = 0; d
if (a[d] > a[d+1]) /* For descending order use
{
temp = a[d];
a[d] = a[d+1];
a[d+1] = temp;
}
}
System.out.print(" [");
for (int i = 0; i
System.out.print(a[i]+" ");
}
System.out.print("]");
}
System.out.println(" Sorted list of numbers:");
System.out.print("[");
for (int i = 0; i
System.out.print(a[i]+" ");
}
System.out.print("]");
}
public void InsertionSort(int[] a){
int temp;
for (int i = 1; i
for(int j = i ; j > 0 ; j--){
if(a[j]
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
}
System.out.print(" [");
for (int c = 0; c
System.out.print(a[c]+" ");
}
System.out.print("]");
}
System.out.println(" Sorted list of numbers:");
System.out.print("[");
for (int i = 0; i
System.out.print(a[i]+" ");
}
System.out.print("]");
}
public void ShellSort(int[] a){
int increment = a.length / 2;
while (increment > 0)
{
for (int i = increment; i
{
int j = i;
int temp = a[i];
while (j >= increment && a[j - increment] > temp)
{
a[j] = a[j - increment];
j = j - increment;
}
a[j] = temp;
}
if (increment == 2)
increment = 1;
else
increment *= (5.0 / 11);
System.out.print(" [");
for (int c = 0; c
System.out.print(a[c]+" ");
}
System.out.print("]");
}
System.out.println(" Sorted list of numbers:");
System.out.print("[");
for (int i = 0; i
System.out.print(a[i]+" ");
}
System.out.print("]");
}
public void MergeSort(int[] a, int low, int high){
int N = high - low;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
