InExercise1youwereaskedtomodifytheSortsprogramsothatitwouldoutput thenumberofswapsusedbyasortingmethod.Itisalittlemoredificulttohavethe programalsooutputthenumberofcomparisons(compares)needed.Youmustinclude oneormorestatementstoincrementyourcounterwithinthesortingmethods themselves.Foreachofthelistedmethods,makeandtestthechangesneeded,and listboththenumberofswapsandthenumberofcomparesneededbytheSorts programtosortanarrayof50randomintegers. a. selectionSort swaps:____ compares:____ b. bubbleSort swaps:____ compares:____ c. shortBubble swaps:____ compares:____ d. insertionSort swaps:____ compares

Respuesta :

Answer:

D. InsertionSort swap: compares

Explanation:

The insertion sort swap is useful in making changes to the program needed to be sorted.

It should be noted that, this method is used to list the numbers of swap and the number of compares which are needed by the sort program.