By what amount have we increased the likelihood

Assignment Help Data Structure & Algorithms
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.

Reference no: EM131036666

Questions Cloud

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 ..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Devise a linear-time algorithm to count the parallel edges

Parallel edge detection: Devise a linear-time algorithm to count the parallel edges in a graph. Write the algorithm in pseudo-code.

  Data array a has data series from 1000000 to 1 with step

data array a has data series from 1000000 to 1 with step size 1 which is in perfect decreasing order.data array b has

  What is the equation of that separates the two classes

What is the equation of that separates the two classes - What can you tell me about the MUSHROOM DATA given in the data link in the DATA Folder. If you can build a classifier - do that. Do whatever you can with this data and tell me what you did an..

  Write a note on priority queue by giving suitable example

Write a note on priority queue by giving suitable example. Write a C function to evaluate a postfix expression using stack. Explain the Division method, Mid square method and Folding method of hash functions.

  Write an algorithm, using pseudo code, "consensus algorithm"

Write an algorithm, using pseudo code, "Word Search": Given a string of letters, identify all substrings that create one of five given words.

  Explain at least four benefits of modular design

-Explain the need for complex data structures and how they are used.

  Use sequential search algortithm to locate the number

These numbers should be stored in an array. Use the sequential search algortithm to locate the number entered by the user. If the number is in the array, the program should display a message.

  Generalize 2-3 algorithms for insert and delete

Generalize the 2-3 algorithms for INSERT and DELETE to K-J trees, where non-leaf vertices have between K and J children for fixed integers K >=2, and J>= 2K-1.

  Create an idef1x entity relationships diagram

The Metropolitan Housing Agency is a non profit corporation that advocates the development and improvement of low income housing.

  What are the differences between a class and an object

What are the differences between a class and an object? What are the similarities and differences of the array and parallel array structures? What is an example of data that is appropriately stored in a parallel array structure

  Write a program using bubble sorting

Question :-Write a program using bubble sorting.

  Create a java program to arithmetic expression

Create a Java program that takes as input an infix arithmetic expression then transforms to a postfix expression and based on binary tree, it evaluates that expression.

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