Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2: Imagine if a phone book was not in order and had one name per page. If there are only a few names, it doesn't

image text in transcribed
2: Imagine if a phone book was not in order and had one name per page. If there are only a few names, it doesn't make sense to sort it. If we use it many times, or there are lots of names, it makes sense to sort it once, and then search, since our search will be much faster. If we have 10,000 names, how many times do we need to search before Sort+Binary search makes sense over Sequential Searchs? If we are going to be searching our phone 1,000,000 times, how big does it need to be for sorting to be worth it? Answer the questions below. As explained in class, sequential search is where we simply iterate through all records until we find what we're looking for. If we sort our records first, we can do binary search, pseudocode for which is supplied in the notes. a. Write the formula for the number of steps to perform k sequential searches on a list of size n f(n, k) = b. Write the formula for the number of steps to perform k binary searches on a list of size n gan, k) = c. If we have 10,000 names, how many times do we need to search before Sort+Binary search makes sense (e.g. is less than) over sequential search? I.e. solve f(10,000,k)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions