Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedplease 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

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago