Given a non-decreasingly sorted array A[p..q] and a number x, consider the following algorithm Search.
SEARCH(A, p, q, x)
1. if A[q] < x
2. return -1
3. if p == q
4. return p
5. else
6. mid = [(p + q)/2]
7. if A[mid] < x
8. return SEARCH(A, mid + 1, q, x)
9. else
10. return SEARCH(A, p, mid, x)
(1) (4pts) Run Search(A, 1, 6, 7) on array A[1..6] = <2, 3, 5, 6, 8, 9>. Find the final return value by listing all the recursive calls made to Search, along with the input p and q values of each call. Note that index starts from 1.
(2) (2pts) Analyze the best-case running time of algorithm search, in terms of n, size of the input array A[p..q] and give a tight bound (using O) on it.
(3) (4pts) Write a recurrence relation describing the worst-case running time of algorithm Search, in terms of n, and solve the recurrence to give a tight bound (using O) on it.