| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Algorithms & Data Structures Discuss algorithms & data structures. Topics are not specific to any programming language. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Finding median of two separate databases.
I'm not too sure how to tackle this question:
Two databases, each containing n elements (for a total of 2n elements, with no two elements being the same). Want to find the median (n-th smallest value). The only way you can access these values is through queries to the databases. For each query, you can only specify a parameter k and the chosen DB will return its k-th smallest value. Give an algorithm that finds the median using at most O(log n) queries. Thanks in advance, Matt |
![]() |
| Bookmarks |
| Tags |
| median of two databases |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|