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

  Algorithm to decide flavor of ice cream

A group of ten people need to decide which one flavor of ice cream they will all order, out of three options. The algorithm can question and re-question the participants, and present the answers to the participants.

  Determining entropy of encrypted message

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

  Give algorithm to find schedule to obtain maximum profit

Give an algorithm to find the schedule that obtains the maximum amount of profit, assuming that all processing times are integers between 1 and n.

  Calculate the cost of sorting relation in seconds

Assume a flash storage device is used instead of disk, and it has seek time of 1 microsecond and transfer rate of 40 MB per second. Recompute the cost of sorting the relation in seconds.

  Write algorithm to reverse elemens in queue

Using basic queue and stack operationns, write algorithm to reverse elemens in the queue. Suppose that 'Stack' is class described in section with 'StackType' set to int and STACK_CAPACITY

  Determining hash value of modified file

Determine hash value of modified file look like, as compared with original hash value?

  What is the most difficult part of creating the algorithm

Pseudocode algorithm you would write for a simple task. What do you think is the most difficult part of creating the algorithm? What can you do to make this process easier?

  Describe properties of bfs and dfs for acyclic tree

Analyze the given properties of BFS and DFS for Acyclic Tree without making any assumptions. Optimality, Completeness.

  Primitives-remove ambiguities in algorithm-s representation

Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Algorithm to find maximum sum of contiguous sublist

Using dynamic programming, write an algorithm to find the maximum sum of contiguous sublist of a given list of n real values.

  Processor sharing to worse performance than fcfs

Create a second experiment answering the question "Is it possible for processor sharing to have worse performance than FCFS? "

  Design algorithm to produce list of customers

Design an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file. Each record on the customer master file contains the customer's number.

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