Question

Consider a file on disk containing 100 records.

For both searches, what is

  1. the average number of comparisons needed to find a record in a file.
  2. number of comparisons if the record is not in the file
  3. the average number of comparisons if the record has a 68% chance of being in the file
  4. the number of disk accesses in the previous 3 questions if the file has 25 records per block
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top