25.9k views
2 votes
Design a program using pseudo code with two parallel arrays: a String array named people and a String array named phone numbers. The program allows you to search for a person's name in the people array. If the name is found, it displays that person's phone number otherwise it should prompt the user the name was not found. The program should use the binary search algorithm

1 Answer

6 votes

Final answer:

To design a program using pseudo code with two parallel arrays, a binary search algorithm can be used to search for a person's name and display their phone number if found.

Step-by-step explanation:

To design a program using pseudo code with two parallel arrays, a binary search algorithm can be implemented. Here is a sample pseudo code:

  1. Define the people array and phone numbers array with the corresponding values.
  2. Sort the people array in alphabetical order to enable the binary search algorithm.
  3. Prompt the user to enter the name of the person they want to search for.
  4. Implement the binary search algorithm to search for the input name in the people array.
  5. If the name is found in the people array, display the corresponding phone number from the phone numbers array.
  6. If the name is not found, prompt the user that the name was not found.

User Josh Justice
by
8.4k points