Question: Write a recursive method that determines whether or not a given item is contained in a given array. Use the following divide-and-conquer strategy: Divide: Split
Write a recursive method that determines whether or not a given item is contained in a given array. Use the following divide-and-conquer strategy: Divide: Split the array into half. Conquer: Recursively check whether the element is contained in at least one of the halves of the array. Combine: If the element is contained in at least one of the two halves of the array, return true. Otherwise, return false. Use Java-like pseudocode. You may use additional helper methods. 1/ returns true if item is contained in array; otherwise, returns false boolean contains (Object array [0,..., n-1], Object item)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
