1. Suppose that you want to search for a friend, ‘S’, telephone number in a phone book. List the steps taken if you use binary search. Illustrate with the list of alphabets ignored during the search by crossing them. (Example – Step 3 – Ignore letter A to C [ABCDEFGHIJKLMNOPQRSTUVWXYZ])

2. In sequential search, you will have to search every page in the phone book until you find your friends’ name and phone number. What are the steps that can be taken to shorten the searching time if the name you are looking for is ‘Joe’?

You're getting close to spamming the board, too. Stop now!!

Go back and add YOUR OWN THOUGHTS to each of your umpteen assignments. Then a tutor might be able to help you.

1. Binary search is an efficient search algorithm to find a specific item in a sorted list of items. Here are the steps to search for a friend's telephone number using binary search:

Step 1: Start with the middle entry in the phone book.
Step 2: Compare the friend's name, 'S', with the name in the middle entry:

- If 'S' is equal to the middle name, you have found the friend's entry and can stop.
- If 'S' is less than the middle name, continue with the left half of the phone book.
- If 'S' is greater than the middle name, continue with the right half of the phone book.

Step 3: Repeat the process with the new half of the phone book.

- If you are searching the left half, ignore the letters that come after the middle entry in the alphabet. For example, if the middle name is 'M', you can ignore the letters 'N' through 'Z' in further search iterations. Cross these letters off from your list.

Step 4: Continue dividing the remaining entries in half, comparing 'S' with the middle name, and repeating until you find the friend's entry or determine it does not exist in the phone book.

Illustration:

Let's assume you have the following phone book entries sorted alphabetically:
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z]

Step 1: Start with the middle entry, which is 'M'.
Step 2: The name 'S' is greater than 'M', so we continue with the right half.
Step 3: Ignore letters after 'M' (N-Z) for further search iterations.
Step 4: The right half of the phone book now becomes [N, O, P, Q, R, S, T, U, V, W, X, Y, Z].

Repeat the steps:

Step 1: Start with the middle entry, which is 'S'.
Step 2: 'S' is equal to the middle name. You have found the friend's entry.

Thus, the search process for finding the friend's telephone number using binary search involves dividing the phone book in half and disregarding the irrelevant letters in each iteration until the entry is found or not present.

2. In the case of sequential search, where every page in the phone book is searched until finding the friend's name, there are a few steps you can take to shorten the searching time if you are looking for the name 'Joe':

Step 1: Begin at the first page of the phone book.
Step 2: Compare each name on the page with the name 'Joe'.
Step 3: If you find a match, you have found your friend's entry and can stop.
Step 4: If the name on the current page is greater than 'Joe', you can stop searching as the list is sorted alphabetically, and 'Joe' will not be found in the remaining pages.
Step 5: If none of the above conditions are met, continue to the next page and repeat steps 2-4.
Step 6: Repeat steps 2-5 until you find the friend's entry or reach the end of the phone book.

By utilizing these steps, you can reduce the searching time in sequential search by avoiding unnecessary searches on pages that are not likely to contain the desired name.