1.Suppose you are given an array a [1, …, n] of distinct sorted (indecreasing order) integers that has been circularly shifted xpositions to the right. For example, [10, 5, 3, 99, 55, 47, 38, 25, 12]is a sorted array that has been circularly shifted x = 3 positions,while [5, 3, 99, 55, 47, 38, 25, 12, 10] has been shifted x = 2positions.1)Write a?(n) algorithm to find the largest element in the array.Justify why your algorithm is?(n). Provide enough details.2)Can you improve your algorithm in part 1 to something moreefficient? If yes, write the algorithm and analyze that in detail.If not, argue why?(n) is the most efficient algorithm you coulddesign for this question.Implement your most-efficient algorithm using ONLY C++/Java. Haveyour complete program files submitted together with your solutionfile. You need to read the array values from an input file calledinput.txt. Here is the required format:91053995547382512where 9 is the size of the array. The rest of numbers are the arrayvalues, i.e., a = [10, 5, 3, 99, 55, 47, 38, 25, 12].
Get answer to your question and much more