CS251 Sorting
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
CS251 Sorting
Requirement
Implement void quicksort(unsigned int *a, int n) as a “C” style function in the file quicksort.cc
1. The pivot should always be chosen as the first element of the array.
2. See the given quicksort.cc file for how to determine running times. You can modify this file as you wish but I should be able to run it to get your output in the file specified.
3. The main function in quicksort.cc reads from the file “quicksortinput” the n integers and writes the n integers to the file “quicksortoutput” in ascending sorted order. See “quicksortsampleinput” and “quicksortsampleoutput” for formatting details. Please make sure that your program can EXACTLY reproduce that output file given the input file. You may want to use the “diff” program to test this.
4. The function sorts the array a of n positive integers with the quick sort algorithm.
Implement void radixsort(unsigned int *a, int n) as a “C” style function in the file radixsort.cc
1. The elements of the array are positive and are represented with 32 bits.
2. See the given radixsort.cc file for how to determine running times. You can modify this file as you wish but I should be able to run it to get your output in the file specified.
3. The main function in radixsort.cc reads from the file “radixsortinput” the n integers and writes the n integers to the file “radixsortoutput” in ascending sorted order. See “radixsortsampleinput” and “radixsortsampleoutput” for formatting details. Please make sure that your program can EXACTLY reproduce that output file given the input file. You may want to use the “diff” program to test this.
4. The function sorts the array a of n positive integers using the radix sort algorithm.
2025-12-31