Question: please only answer both c questions and while doing so explain steps 2: Imagine if a phone book was not in order and had one

please only answer both c questions and while doing so explain stepsplease only answer both c questions and while doing so explain steps

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 8(n, 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? l.e. solve f(10,000,k)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!