Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

LO6 Describe how to choose among the recruitment sources.

Answered: 1 week ago