MinimumFinding

MinimumFinding - Problem: Median Finding Algorithm for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Problem: Median Finding Algorithm for Joint Databases You are interested in analyzing some hard to obtain data from two separate databases. Each database contains n numerical 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 nth smallest value. However, the only way you can access these values is through queries to the databases. In a single query you can specify a value k to one of the two databases and the chose database will return the k-th smallest value that it contains. Since queries are expensive you would like to compute the median using as few queries as possible. Give an algorithm that fins the median value using at most O(logn) queries. Solution Let assume D1 and D2 are the two given databases. Here is a median finding algorithm for joint databases. q1 = q2 = n/2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

MinimumFinding - Problem: Median Finding Algorithm for...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online