Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 1 page 2-16, repeated here for your convenience. You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n
Exercise 1 page 2-16, repeated here for your convenience. You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n numberical values so there are 2n values total and you may assume that no two values are the same. You'd like to determine the median of this set of 2n values, which we will define here to be the n^lh smallest value. However, the only way you can access these values is through ijuertes to the databases. In a single query, you can specify a value k to one of the two databases, and the chosen database will return the k h smallest value that it contains. Since queries are expensive you would like to compute the median using as few queries as possible. Describe a brute force algorithm for solving this problem. What is the runtime of this algorithm? To reduce this runtime we must be able to discard a fraction of the search space basod on a constant number of queries to reduce the number of future iterations/recursive calls. Explain why this approach is needed if we want to bring the runtime down to logarithmic time. Suggest an approach that would allow us to reduce the search space based on a constant number of queries. By how much does you suggestion reduce the search space? (1/2, 1/4, 1/3?) Look Ahead: During yoiu- next tutorial you will give pseudocode for the algorithm and give a recurrence for the runtime of the algorithm. Exercise 1 page 2-16, repeated here for your convenience. You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n numberical values so there are 2n values total and you may assume that no two values are the same. You'd like to determine the median of this set of 2n values, which we will define here to be the n^lh smallest value. However, the only way you can access these values is through ijuertes to the databases. In a single query, you can specify a value k to one of the two databases, and the chosen database will return the k h smallest value that it contains. Since queries are expensive you would like to compute the median using as few queries as possible. Describe a brute force algorithm for solving this problem. What is the runtime of this algorithm? To reduce this runtime we must be able to discard a fraction of the search space basod on a constant number of queries to reduce the number of future iterations/recursive calls. Explain why this approach is needed if we want to bring the runtime down to logarithmic time. Suggest an approach that would allow us to reduce the search space based on a constant number of queries. By how much does you suggestion reduce the search space? (1/2, 1/4, 1/3?) Look Ahead: During yoiu- next tutorial you will give pseudocode for the algorithm and give a recurrence for the runtime of the algorithm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started