Question 1. Show in the style given in the class, how the last 5 digits of your student number (e.g. 123456789) will be
Posted: Tue Jul 12, 2022 8:20 am
Question 1. Show in the style given in the class, how the last 5digits of your student number (e.g. 123456789) will be sorted usingthe following sorting algorithms- Please make sure to change thesedigits to be unique digits:
a. Selection sort-[5 Marks]
b. Insertion sort-[5 Marks]
c. Quick sort-[5 Marks]
d. Merge sort [5 Marks]
e. Bubble sort-[5 Marks]
f. heap-sort (min-heap)-[5 Marks]
Question2. Write a program in C, which compares the performanceof 4 sorting algorithms. Each algorithm sorts n numbers from aninput file containing a list of numbers. Each program then sorts nnumbers and prints the numbers to a file. You Should use theimplementations of the sorting algorithms from the class notes.
1. Insertion sort algorithm(G1).
2. Selection sort algorithm(G2).
3. Quick sort algorithm(G3).
4. Heap-sort algorithm (G4).
b. Dataset 1: Run your program on values from 1 to n where n=10,000 (i.e. input numbers are sorted and there is no need to readfrom an input file). Print the execution time on the screen withwell explained messages for each algorithm.
c. Dataset 2: Read in the first 10,000 entries only found in“test_dat.txt” and Run your program. Print the sorted input andexecution time to 4 output files called (G1.txtx, G2.txt, G3.txtx,G4.txt)
a. Selection sort-[5 Marks]
b. Insertion sort-[5 Marks]
c. Quick sort-[5 Marks]
d. Merge sort [5 Marks]
e. Bubble sort-[5 Marks]
f. heap-sort (min-heap)-[5 Marks]
Question2. Write a program in C, which compares the performanceof 4 sorting algorithms. Each algorithm sorts n numbers from aninput file containing a list of numbers. Each program then sorts nnumbers and prints the numbers to a file. You Should use theimplementations of the sorting algorithms from the class notes.
1. Insertion sort algorithm(G1).
2. Selection sort algorithm(G2).
3. Quick sort algorithm(G3).
4. Heap-sort algorithm (G4).
b. Dataset 1: Run your program on values from 1 to n where n=10,000 (i.e. input numbers are sorted and there is no need to readfrom an input file). Print the execution time on the screen withwell explained messages for each algorithm.
c. Dataset 2: Read in the first 10,000 entries only found in“test_dat.txt” and Run your program. Print the sorted input andexecution time to 4 output files called (G1.txtx, G2.txt, G3.txtx,G4.txt)