Question: 1ts) In this quiz, we will define a unimodal array as an array of'distinct' integers wherein the array is a sequence of monotonically decreasing integers

 1ts) In this quiz, we will define a unimodal array as

1ts) In this quiz, we will define a unimodal array as an array of'distinct' integers wherein the array is a sequence of monotonically decreasing integers followed by a sequence of a (logn) algorithm to determine the minimum element in die unimodal array monotonically increasing integers. Design (a) Show the pseudo code of your algorithm (b) Justify the cormectness of the algorithm (c) Analyze the run-time complexity of the algorithm and show that it is e(logn) (d) Show the working of the algorithm (along with the appropriate index values) for three different cases (in each case, the array should be of size at least 10 integers) i) the array is a sequence of monotonically decreasing integers followed by a sequence of monotonically increasing integers i) the array is strictly a sequence of monotonically decreasing integers i) the array is strictly a sequence of monotonically increasing integers Q2: 25 points) Consider a sorted, but rotated array of distinct integers (i.e, no two integers are th For example, the following sorted array 2 358 9 1014 18 28 30 2 3 6 910 14 1828 30 when rotated three elements to the "left" becomes: 8 9 10 14 18 28 30 2 3 5 All the elements (except an element called the pivot at index p) of the sorted, but rotated array of integers have a property that they are less than the element to the right of them. Only the pivot element is greater than the element to the right of it. In the above sorted, but rotated array of integers, the pivot is the integer 30 at index 6. Incidentally the pivot also happens to be the largest element in the array and is the last element in the original sorted array (before the rotation). In the above example, the pivot element 30 is the largest element of the array and is also the last element of the original sorted array (before the rotation) (a) Design a binary search-based algorithm to identify the pivot in a sorted, but rotated array of integers (b) Extend the algorithm of (a) to do a successful search for a key that is present in the sorted, but rotated array (c) Extend the algorithm of (a) to do a unsuccessful search for a key that is not present in the sorted, but rotated array (d) For each of the algorithms in (a), (b) and (c). illustrate the execution of the algorithm for the array given in the problem statement. (e) Analyze the time complexity of the algorithms of (a), (b) and (c). Note that in addition to describing the working of your algorithms, you should also write the pseudo code for your algorithms of (a), (b) and (c)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!