sequential search homework question
Posted
by Phenom
on Stack Overflow
See other posts from Stack Overflow
or by Phenom
Published on 2010-03-09T03:31:37Z
Indexed on
2010/03/09
3:36 UTC
Read the original article
Hit count: 714
Consider a disk file containing 100 records a. How many comparisons would be required on the average to find a record using sequential search, if the record is known to be in the file?
I figured out that this is 100/2 = 50.
b. If the record has a 68% probability of being in the file, how many comparisons are required on average?
This is the part I'm having trouble with. At first I thought it was 68% * 50, but then realized that was wrong after thinking about it. Then I thought it was (100% - 68%) * 50, but I still feel that that is wrong. Any hints?
© Stack Overflow or respective owner