C Algorithms quicksort and bubblesort exercise and short report write up.
$30-5000 USD
Cancelado
Publicado hace más de 19 años
$30-5000 USD
Pagado a la entrega
In this lab you will implement in C some sorting algorithms and compare their running times. You need to use quicksort and bubblesort.
Also you need to complete a short lab report once these simple exercises have been completed.
## Deliverables
In this lab you will implement in C some sorting algorithms and compare their running times.
**Lab 2 Section 1
****1.1 **Create a C program that can sort an array of random integers using the quicksort algorithm. You are free to use the quicksort code supplied with this document as the starting point. (The starting code for quicksort and timmer codes will be sent to you once i have accepted your bid).
**1.2 **Investigate the time taken to complete the sort, for files of varying sizes. Plot a suitable graph of running time against N, where N is the number of elements in the array. Compare the running time with the theoretical N logN dependence.
**Section 2
****2.1 ** Write a C program to sort the same random integer arrays using the bubblesort algorithm.
**2.2 ** Investigate the time taken to complete the sort, for files of varying size. Plot a suitable graph of running time against N, and compare the running time with the theoretical O(N2) behaviour.
**Section 3 - Extension
**If your work in Sections 1 and 2 shows that bubblesort is faster for small values of N, create a new program in which the quicksort algorithm is replaced by a call to a bubblesort function when the array to be sorted is small enough to make this advantageous. Demonstrate the benefits of your hybrid algorithm by plotting its running time vs N.
If your work in sections 1 and 2 does not show bubblesort to be faster for small values of N, investigate other ways in which your quicksort algorithm can be improved, as suggested in the lectures.
**Section 4 Conclusions.**
What conclusions can you draw about the relative merits of the sorting algorithms you have investigated in this lab?
5. Complete the short report. The template has been attached to this document please answer all questions fully.
6. All code must be fully commented.
## Platform
windows ME and XP