Question: In Java (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

In Java

(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 arr[lr] is present, otherwise -1.

The terSearch search function, unlike the binary search, must consider two dividing points

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

What is the running time complexity of your function? Justify.

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!