Question: Please answer the three questions above and explain them thoroughly step by step as to how you got the answer. Suppose that we were to
Please answer the three questions above and explain them thoroughly step by step as to how you got the answer.
Suppose that we were to rewrite the for loop header in line 10 of the COUNTINGSORT as 10forj=1toA.length Show that the algorithm still works properly. Is the modified algorithm stable? Q8. (Section 8.3) Which of the following sorting algorithms are stable: insertion sort, merge sort, heapsort, and quicksort? Give a simple scheme that makes any sorting algorithm stable. How much additional time and space does your scheme entail? Q9. (Section 8.4) Explain why the worst-case running time for bucket sort is (n2). What simple change to the algorithm preserves its linear average-case running time and makes its worst-case running time (nlgn)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
