sequential vs. binary search [closed]
Consider a file on disk containing 100 records.
For both searches, what is
- the average number of comparisons needed to find a record in a file.
- number of comparisons if the record is not in the file
- the average number of comparisons if the record has a 68% chance of being in the file
- the number of disk accesses in the previous 3 questions if the file has 25 records per block
You might want to have a look at this SO thread:
What is the difference between Linear search and Binary search?
--
The reason people are down-voting you is that you just copied and pasted your homework problem. You have not shown in any way that you have actually tried studying your textbook, then searched using Google and SO, then attempted this problem, and only then posted your question.
精彩评论