How do I code a binary search involving two arrays of words? [closed]

1 week ago 12
ARTICLE AD BOX

I have two arrays (one going from 0-49 listing every US state, and another one going from 0-49 listing the US capitals.) and I need to binary search the second array to match a selected US state to capital. How do I do that?

Here's the code I've got. I should return State Capital + number of probes.

public static int BinarySearch(String key, String[] a) { int lo = 0; int hi = a.length - 1; int mid = 0; String stateinarray = ""; NumberofProbes = 0; // YOUR CODE GOES HERE
Read Entire Article