Question: a. Suppose A[0n1] just contains the numbers1,0,1. Design an algorithm that sorts the elements of A in-place in O(n) time. That is, your algorithm shouldnt
a. Suppose A[0n1] just contains the numbers1,0,1. Design an algorithm that sorts the elements of A in-place in O(n) time. That is, your algorithm shouldnt use another array. The main operations should just involve swapping elements. b. Weve discussed heapsort, mergesort and quicksort. (i) For each one, determine if it is stable or not. If yes, explain why; otherwise, provide an example that shows the algorithm is not stable. (ii) If the algorithm is not stable, describe a x you can make so the algorithm is stable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
