Answer:
The Algorithm for finding a number from a phone book with the person's name as the input and the phone number as output is as follows:
1. Try to remember the name, i.e last name first and first name last, Also make sure you get the spelling right.
2. Using the first letter of the last name, locate the appropriate alphabetical section in which the name should appear.
3. Using the second letter of the last name, find the subsection of first and second letters combined, in the appropriate order, in which the name should appear. (If the last name consists of only two letters, find the appropriate first name.)
4. Using the third letter, find the possible names in a subsection of the first three letters in the correct order. Continue this step with x+1 letters of the name until you have a subsection of names exactly matching the last name of the person whose number you are trying to locate. (x is the number of letters used in the previous step, consistently.) If there is only one of the last name, (check for duplicates) identify the number, and return phone number information.
5. Begin the second step using the first letter of the first name, but limit the section to only those exactly matching the last name. Continue to step 4, again focusing on the first name only within the set of exactly matching last names.
6. When both first and last name match the name you are locating, check for duplicates. IF there are no duplicates, return phone number information.
Explanation:
People's names are generally arranged in phone books in alphabetical order by the last name of the person. The first name of the person is listed after the last name so that people of the same last name can be differentiated.