### Write algorithm to find median value using queries

Assignment Help Data Structure & Algorithms
##### Reference no: EM1371240

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. Ina single query, you can specify a value k to one of the two databases, and the chosen database will return the/(m 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 finds the median value using at most O(log n) queries.

#### Questions Cloud

 Compute calvin profit-maximizing output level : Compute  Calvin's profit-maximizing output level. Compute the Calvin's economic profits at this activity level. Is this activity level sustainable in long run? Knowledge about business management : how taking the QRB course will prepare you for future courses in economics, finance, accounting, and research. Local public agencies were capital constrained : Suppose you are Chief Economist of the FCC. The Chairman has called you in to discuss a thorny issue. Two wireless broadcasters operate on adjacent frequencies. Perfect competition-cost curves : When developing short-run cost curves, it is supposed that all firms in perfect competition have the same cost curves and they all make identical short-run profits or losses. Write algorithm to find median value using queries : As queries are expensive, you would like to calculate median using as few queries as possible. Provide the algorithm which finds median value using at most O(log n) queries. Effect of retained earnings on divisions of a company : When the company I work for earns a profit on a project by coming in under budget on expenses or by finishing before the project due date, would that be retained earnings? Determining amount of profit and loss : Johnston production is the price taker which utilizes this cost structure in the short run: Question related to mass customization : Question related to mass customization - What challenges would an organization face if it sought to rely on mass customization more Model of perfect competition : Describe and discuss the model of perfect competition and adopting strategies to gain market power in the competitive industries.

### Write a Review

#### Devise algorithm to generate access control matrix

Devise an algorithm that generates an access control matrix A for any given history matrix H of the Chinese Wall model. A significant portion of the grade for this problem involves your justification of your algorithm.

#### Encryption feistel cipher and decryption algorithm

If this is psudocode for encryption feistel cipher determine decryption algorithm?Output: ciphertext = (left[16], right[16]) Explain pseudo-code of corresponding decryption algorithm for this cipher.

#### Describe algorithm that finds maximum feasible flow in graph

Describe an algorithm that finds a maximum feasible flow in G. Denote by MF(|V|, |E|) the worst-case running time of an ordinary maximum flow algorithm.

#### Create time algorithm-minimum time required to finish task

Create the O(|V | + | E |) time algorithm which, given times ti and the dependencies, determines minimum time required to complete all the tasks.

#### Implement a queue as a circular array

Implement a queue as a circular array as follows: Use two index variables head and tail that contain the index of the next element to be removed and the next element to be added.

#### Design algorithm to receive two integer items from terminal

Design an algorithm that will receive two integer items from a terminal operator, and display to the screen their sum, difference, product and quotient.

#### 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? "

#### Decrypting the ciphertext to recover the plaintext

If you get ciphertext message YPHDCRPBEQTAA, decrypt to recover plaintext.

#### Use a search tree to find the solution

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

#### Implement iterative version of algorithm heapify

Using any programming language to implement iterative version of algorithm HEAPIFY. Show your algorithm by running it on the array that contain your name characters.

#### Design algorithm to find the average miles per gallon

Design an algorithm to find the average miles per gallon. Sample data: 68723, 71289, 15.75, 16.30, 10.95, 20.65, 30.00.

#### Js code to prompt the user for integer and print result

Write JS code which prompt the user for an integer and prints the result.