Modify the two sorts shown below to count the number of comparisons made by having the addElement? routines return an integer count of the comparisons made during the function call. You will need to modify both ?Sort routines so that they accumulate the counts returned by the addElement? function calls, and then return the accumulated total as the result. Write a main program to call both of the sort functions with arrays of at least 20 elements. How many comparisons do each of the functions make? Try calling each function with randomly ordered numbers, sorted numbers, and reverse-sorted numbers. What is the result? Submit your code, along with the main program used to compare the sort functions.
It should work according to the specifications. It should be written in visul C++.
Windows XP, Me Internet Explorer