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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3c3e2ebfa9_42666f3c3e26cb16.jpg)
** 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
Get step-by-step solutions from verified subject matter experts
