Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need number 2 answered. Please provide in detail to be able to follow. 1. You are interested in finding the median salary in Polarized

image text in transcribed

I need number 2 answered. Please provide in detail to be able to follow.

1. You are interested in finding the median salary in Polarized County. The county has two towns, Happyville and Sadtown. Each town mantains a database of all of the salaries for that particular town, but there is no central database. Each town has given you the ability to access their particular data by executing queries. For each query, you provide a particular database with a value k such that 1 sk s n, and the database returns to you the kth smallest salary in that town. You may assume the following: Each town has exactly n residents (so 2n total residents across both towns) . Every salary is unique (i.e., no two residents, regardless of town, have the same salary) We define the median as the nth highest salary across both towns Design an algorithm that finds the median salary across both towns in (log(n)) total queries. 2. State the complete recurrence for your algorithm. You may put your f(n) in big-theta nota- tion. Use the master theorem to show the solution for your recurrence is (log(n)). If your algorithm is slower, give us the actual running time

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions