Problem

In Segment 18.7, we said that a sequential search of an array will examine on average abou...

In Segment 18.7, we said that a sequential search of an array will examine on average about half of the n entries. Let’s look a little more carefully at this computation. A sequential search is either successful or not. Let α be the probability that we will find the desired value in the array and 1 – α be the probability that we will not. We further assume that the value, if found, is equally likely to be in each of the locations of the array. We need to consider each possibility.

For each case, we count the comparisons and determine its probability of occurrence. To find the average number of comparisons made by the search, we first multiply each probability by the number of comparisons in each case. The following table summarizes these results:

a. Compute the average number of comparisons by adding all the products in the last column of the table.


b. What is the average number of comparisons if the search is guaranteed to be successful (α= 1)?


c. What is the average number of comparisons if the search is guaranteed to be unsuccessful (α = 0)?


d. What is the average number of comparisons if the search is successful half of the time (α = 0.5)?

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 18
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT