Question: Complexity Analysis: Heaps Give the run-time complexity of the following code segments. The input size is n. Give the tightest possible bound. Remember to ignore

Complexity Analysis: Heaps Give the run-time complexity of the following code segments. The input size is n. Give the tightest possible bound. Remember to ignore coefficients and lower-order terms. 1. (2 points) After inserting n items into a maximum heap in sequential order, what is the worst case performance for finding the single largest item in the tree? nswer 2. (2 points) After inserting n items into a minimum heap in random order, what is the worst case performance for finding the single largest item in the tree? Answer: 3. (2 points) In a minimum heap of n items, what is the worst case performance for finding the most frequently occurring item inside? Answer: 4. (2 points) Given an array of n items, what is the worst case performance for putting the array in heap-order through heapification? Answer 5. (2 points) What is the worst case performance for removing the smallest item from a minimum heap of size n? Answer: Heapsort 6. (2 points) The heapsort algorithm is not but you can make it appear so by on items inserted into the heap. using a A. In-Place, Comparator B. Stable, Comparator Wrapper E. None of the above C. Stable, Wrapper D. In-Place Answer: 7. (4 points) What is the complexity of heapsort when sorting an array already in sorted order? A. w() B. S(nlog(n) C.O(nlog(n) D. (2) E. All of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
