Question: I need help with this assignment! Our professor does not explain well in the class and I do not really have an idea what to

I need help with this assignment! Our professor does not explain well in the class and I do not really have an idea what to do! It's a C -language course.

Thank You!

I need help with this assignment! Our professor does not explain wellin the class and I do not really have an idea whatto do! It's a C -language course. Thank You! Due: Goal: Studythe effect of pivot choice on number of comparisons made by partition

Due: Goal: Study the effect of pivot choice on number of comparisons made by partition algorithm used for partitioning data around the pivot value in quick sort algorithm. Constraints: - memory for data set allocated dynamically - data set memory to be returned to system after usage data set generated using random number generator - uses counts using key idea presented in class - compile using make/Makefile Statement : Write a modular, properly documented C-programs to study the above mentioned (in goal). The pivot value choices are: at mean of at first position and at last position (that is, at (first+last) /2) and and at random position in range of first to last positions (that is, first+ (random() * (last-first+1)). The data set size is specified on command-line (handle the case when no argument is available). The programs will be invoked as: ./qsortm ./qsortr Modules to use/write: 1. int main(int argc, char *argv[]); { generates data set using random() as needed } 2. void loaddata (int dat[], int size): {generate and load random integer values in data set } 3. int partition (int dat[], int first, int last); { chooses and adjust pivot value, return the position of pivot value after partitioning } 4. void qsort (int dat[], int left, int right); { calls partition () and itself as needed } 5. others?? Sample output: qsortr: size: comparisons: 10000 20345 -------- compares = 0; /* global variable */ check args to main, bail-out on error seed random number generator allocate memory for data set, bail-out on error generate data and load into data set call quick sort Page 2 of 2 a4.txt print result free allocated memory terminate --- partition algorithm arranges so that first location has pivot value { middle or random choices} partition around pivot value { iterative procedure } quick sort call partition algorithm { update global comparison count } call quick sort on left interval call quick sort on right interval

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!