QUESTION 6 Choose the best sorting algorithm in the following scenarios AND write it's time complexity in that scenario. When the input is sorted A Merge Sort B. Selection Sort When the available memory is limited. C.insertion sort D.Quick Sort QUESTION 7 Suppose the running time of applying Selection Sort on a given array is 1024ms. How much time do we need to spend using Merge sort to sort on the same array? Al QUESTIONS Assume that we call partition on an array of size 10, and the result after partitioning is: 532 11 15 21 12 17 60 What was the pivot? JA QUESTION 9 Assume I have an efficient method to compute median of an array in O(n). In this case, if I choose the median as the pivot, what would be the time complexity of quick sort? IA QUESTION 10 Please fill in the missing statement (one statement) to implement the partitioning process for Quick Sort? [A] public int partitionIt(int left, int right, long pivot) { int leftPtr = left - 1; // left (after ++) int rightPtr right; // right-1 (after --> while (true) { while (leftPtr right theArray(leftPtr+1) white (rightPtr > W theArrayI--rightPtr) > pivot) { if (leftPtr > rightPtr) // if pointers cross, break; // partition done else // not crossed, so swap(leftptr, rightptr); // swap elements // end while(true) swap(leftPtr, right); // restore pivot return leftPtr; // return pivot location // end partitionIt() QUESTION 11 Please fill in the missing codes to implement the enqueue method for a maximum priority queue implemented by an array, class PriorityQueue { // array in sorted order, from min at o to max at size-1 private int maxSize; private int Il gueAccay private int nItems; // public PriorityQueue int max) // constructor { maxSize = max; queAccay = new int (maxSize): nItems: } // public void enqueue(int iten) // enqueue an element // YOUR CODES } // public int dequeue() // dequeue the maximum elenent { return QueAccayl--nItems): }