Programming Homework Help

Programming Homework Help. java coding help

 

In this lab you will experiment with sorting array of integers problem. You will implement different sorts we covered in class and labs and write a test problem to compare running time on different input sizes. Separated into 6 parts, but you will submit only one program and report. See question 6.

1. (3 points) Implement merge sort.

2. (3 points) Implement selection sort.

3. (3 points) Implement heap sort using java.util.* PriorityQueue structure.

4. (3 points) Implement binary search tree sort using our binary search tree structure from the lab.

5. (2 points) Write a method to create a random array of integers of given size n. The array values should be between -1000 and 1000 inclusive. Use random!

6. (5 points) Create a program that includes all the methods above. The program first generates (using method from 5) arrays of size 100, 1000, 10000, 100000, 1000000, 1000000000. Than calls each of the sorts on each of the arrays and reports running time of the execution (prints on console). Use System.currentTimeMillis(); to time the execution. Submit both program and report (how long each sort takes on every input).

public class testSort{

public static void main(String[] args){

}

public static void mergeSort(int[] a){

}

public static void selectionSort(int[] a) {

}

public static void heapSort(int[] a){

}

public static void bstSort(int[] a){

}

public static int[] createRA(int n){

}

}

Report should have structure:

mergeSort on 100 elements takes:

mergeSort on 1000 elements takes:

bstSort on 1000000 elements takes:

bstSort on 1000000000 elements takes:

Programming Homework Help