Question: CHALLENGE ACTIVITY 2 . 3 . 2 : Recursive algorithm: Search. 5 2 2 5 6 2 . 3 5 7 8 1 9 4

CHALLENGE
ACTIVITY
2.3.2: Recursive algorithm: Search.
522562.3578194.4329y7
Jump to level 1
String targetState and integer numData are read from input. Then, numData alphabetically sorted strings are read from input and each string is added to an ArrayList. Complete the find 0 method:
If targetState is alphabetically before midValue (the element at index midlndex of the ArrayList), output "Search lower half" and recursively call find 0 to find targetState in the lower half of the range.
Otherwise, output "Search upper half" and recursively call find(0 to find targetState in the upper half of the range.
End each output with a newline.
Click here for example
Note: str1.compareTo(str2)0 returns true if str1 is alphabetically before str2, and returns false otherwise.
import java.util.Scanner;
import java.util.ArrayList;
public class FindState {
public static void find(ArrayList
 CHALLENGE ACTIVITY 2.3.2: Recursive algorithm: Search. 522562.3578194.4329y7 Jump to level 1

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!