(a) Implement a recursive search function in Java int terSearch(int arr, int l, int r, int x) that returns location of x in a given sorted array…

(a) Implement a recursive search function in Java

int terSearch(int arr[], int l, int r, int x)

int d1 = l + (r – l)/3

int d2 = d1 + (r – l)/3

a. b.It is 0.000001 secondsSee working below and screenshot for justification