Write algorithm to calculate the median using queries

Assignment Help Data Structure & Algorithms
Reference no: EM1368930

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 in all - and you can 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 as the n-th 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 databases, and the chosen database will return the k-th smallest value that it contains. Since queries are expensive, you would like to calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

Reference no: EM1368930

Questions Cloud

Find the speed of the moving charge : Two identical 30 {rm g} particles each carry 3 {rm mu C} of charge. One is held fixed, and the other is located 1 {rm mm} away and released. Find the speed of the moving charge when it's 1{rm cm} from the fixed charge.
Explain new technologies or material changes : Explain new technologies or material changes that transform businesses' or companies' expectations and the way they interact
Considerations for training development : Considerations for Training Development - Show the process through which training needs identified in the analysis phase are translated into the training objectives.
What is the goal of employee development : What is the relationship between employee training and employee development and are both necessary within an organization
Write algorithm to calculate the median using queries : Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.
Determine the constant velocity of car : Two cars cover the same distance in a straight line. Car A covers the distance at a constant velocity. Car B starts from rest and maintains a constant acceleration. Both cars cover a distance of 547m in 221s.
Describe how you think a biographer causes of the event : Describe how you think a biographer, historian, or social scientist would describe the causes and consequences of the event
What is the linear charge density along the arc : A wooden raft has a mass of 59 kg. When empty it floats in water (density 1000 kg/m3) with 59 percent of its volume submerged. What mass of sand can be put on raft without it sinking.
Analyzing competitive markets : In a speech, Professor Gregory Mankiw contends that our elected federal leaders should raise the gasoline tax. Not quickly, but substantially.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Computing hash value for message

For a message, he computes the hash value H = (VChar 1 x VChar 2 x VChar 3 ...x VChar N) mod(26).

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  Algorithm for a bank account

Write algorithm to settle following question: A bank account starts out with $10,000. Interest is compounded monthly at 6 percent per year (0.5 percent per month).

  Design algorithm determining annual profit for company

Your goal is to solve the following simple programming exercise. You have been asked by your accounting department to design an algorithm determining the annual profit for your company.

  Design algorithm to compute and print average earnings

Design an algorithm to compute and print the average earnings,lowest earnings and highest earnings of a group of employees.

  How to calculate signature using mod

How does he calculate the signature on each of m1j mod n (for positive integer j), m1-1 mod n, m1*m2 mod n, and in general m1j*m2k mod n (for arbitrary integers j and k)?

  Determining entropy of encrypted message

If this message is encrypted with DES by using a random 56-bit key, determine encrypted message's entropy?

  Process of insertion into a heap-implemented priority queue

Explain the process of insertion into a heap-implemented priority queue, and informally explain its complexity and the process of removal from a heap-implemented priority queue, and informally explain its complexity.

  Creating financial tracking program

Acme Inc. is making next generation financial tracking program, and Alice has been provided the task of writing encryption component.

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Effective address-addressing mode of instruction is direct

Evaluate the effective address if the addressing mode of the instruction is (a) direct; (b) immediate; (c) relative; (d) register indirect.

  Explaining view of header and footer areas of worksheet

In which view can you see header and footer areas of worksheet?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd