Question: 4. Question 4 is about Sorting Algorithms. (a) Suppose that your Quick-Sort algorithm uses the following pivot rule that picks the element in the middle

4. Question 4 is about Sorting Algorithms. (a) Suppose that your Quick-Sort algorithm uses the following pivot rule that picks the element in the "middle" - For an array A[0,1,..., n - 1 of size n, it uses the element in An/2] as pivot if n is even and the element in Al(n-1)/2] as pivot if n is odd. Give an input array of size 7, with values 1 to 7, on which your quick-sort algorithm that run the slowest. 5 Marks (b) Describe how Insertion-Sort Algorithm works by writing its pseudo-code. [5 Marks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
