Question: ** 1 Q3. [20 marks] Fill in the function below and analyze its time complexity. int find_peak(int n, int A[]) Given an array of n

 ** 1 Q3. [20 marks] Fill in the function below and

** 1 Q3. [20 marks] Fill in the function below and analyze its time complexity. int find_peak(int n, int A[]) Given an array of n integers, A[0] ... A[n 1], there exists an index number 0) A[x + 1] > ... > > A[n 1] In another word, A[x] is the peak value in this array. The function find_peak aims to locate x efficiently and return the peak value A[x]. You need to fill in the code in line 9 and line 13. - Analyze the time complexity of find_peak(n, A) in big-O notation. int find_peak (int n, int A[]){ int left, right, lmid, rmid; left = 0; right = n 1; while(left + 3 A[x]). return A[x]; 15} 2 3 4 5 6 7 8 9 10 11 12 13 14

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!