Reference no: EM131036666
Median-of-3 partition
One way to improve the RANDOMIZED-QUICKSORT procedure is to partition around a pivot that is chosen more carefully than by picking a random element from the sub array. One common approach is the median-of-3 method: choose the pivot as the median (middle element) of a set of 3 elements randomly selected from the sub array. For this problem, let us assume that the elements in the input array A[1 ? n] are distinct and that n ≥ 3. We denote the sorted output array by A"[1 ? n]. Using the median-of-3 method to choose the pivot element x, define pi = Pr{x = A"[i]}.
a. Give an exact formula for pi as a function of n and i for i = 2, 3,..., n - 1. (Note that p1 = pn = 0.)
b. By what amount have we increased the likelihood of choosing the pivot as x = A"[⌊(n + 1/2⌋], the median of A[1 ? n], compared to the ordinary implementation? Assume that n → ∞, and give the limiting ratio of these probabilities.
c. If we define a "good" split to mean choosing the pivot as x = A"[i], where n/ ≤ i ≤ 2n/3, by what amount have we increased the likelihood of getting a good split compared to the ordinary implementation? (Hint: Approximate the sum by an integral.)
d. Argue that in the Ω(n lg n) running time of quicksort, the median-of-3 method affectsonly the constant factor.
Construct an appropriate diagonalizing matrix
: Construct an appropriate diagonalizing matrix, decouple the linear system - Construct an appropriate diagonalizing matrix, decouple the linear system, then solve the nonhomogeneous system.
|
Classical model and the solo growth model
: What are the differences between the Classical Model and the Solo Growth Model in macroeconomics?
|
Implementing an expansionary monetary policy
: 1. In 1992 the Central Bank of Japan resisted implementing an expansionary monetary policy because
|
Determine the gravimetric analysis of the mixture
: A gas mixture has the following composition on a mole basis: 60 percent N2 and 40 percent CO2
|
By what amount have we increased the likelihood
: If we define a "good" split to mean choosing the pivot as x = A"[i], where n/ ≤ i ≤ 2n/3, by what amount have we increased the likelihood of getting a good split compared to the ordinary implementation?
|
Find community program -focuses on addressing health issues
: Identify one community based program (in Prince George's County, Maryland or Washington, D.C) that focuses on addressing health issues. The program will focus on behavior change, changing local environments for health, or developing new health pol..
|
Determine the mass fractions of the constituents of air
: The composition of moist air is given on a molar basis to be 78 percent N2, 20 percent O2, and 2 percent water vapor.
|
Transactions demand for money
: According to Baumol and Tobin, the transactions demand for money is
|
Business matters within the company
: Mr. Smith is a retired director of XYZ Co Ltd, he was not appointed a director for the current year (2014), but still attends to many of the business matters within the company, and also attends the directors meetings to advise and mentor the new ..
|