Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started