开发者

sequential vs. binary search [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reop开发者_C百科ened, visit the help center for guidance. Closed 10 years ago.

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜