a write a program in java to implement a recursive searchfunction int tersearch int 4951606

(a) Write a program in Java to implement a recursive searchfunction int terSearch(int A[], int l, int r, int x) that returns the location of x in a given sorted array of nintegers A if x is present, otherwise -1. The terSearch search function, unlike the binary search, mustconsider two dividing points int d1 = l + (r – l)/3 int d2 = d1 + (r – l)/3 For the first call of your recursive search function terSearchyou must consider l = 0 and r = A.length – 1. (b.1) Implement a sub-linear running time complexity function inJava long exponentiation(long x, int n) to calculate x n . (b.2) What is the running time complexity of your exponentiationfunction? Justify. Important Notes: For items (a) and (b.1) you must add the main method in yourprogram in order to test your implementation. There are no data errors that need to be checked as all the datawill be assumed correct. For item (b.1) your function you can use only the basicarithmetic operators (+, -, *, %, and /). Attached

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now