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

  Design of web pages

Explain how a web designer defines a page as XHTML as opposed to HTML and recognize two different types of XHTML standards.

  Write a concise summary about physical tamper-resistant

Write a concise summary (ideally one to two pages) of what you have learned about physical tamper-resistant devices.

  Write forensic analysis for the windows 7 os

Download one of the forensic tools at http://forensiccontrol.com/fcresources.php, run it on Windows 7 OS, make up exercises that will test its capabilities and evaluate it. Write a one-page report on its potential use in forensic analysis for the ..

  Find a shortest-path from u to v

find a shortest-path from u to v, and we have a *valid* heuristic, i.e.: For every node w, we have a value a(w) such that the distance from w to v in G is at least a(w) for all nodes w.

  What is difference between serial and sequential searching

What is the difference between serial, sequential and indexed sequential searching

  Explaining playout delay algorithm

Let the adaptive playout delay algorithm. Show through simple example that adjusting playout delay at beginning of each talk.

  Database design process

A college course may have one or more scheduled sections, or may not have a scheduled section. Attributes of COURSE include Course_ID, Course_Name, and Units.

  Describe an algorithm to play the game of nim using all of

describe an algorithm to play the game of nim using all of the three tools discussed in class pseudocode flowchart

  What should be modeled as threads

What should be modeled as variables? Which of them should be global (shared) and which can be local? What problems can occur in this game? (List all instances and be specific)

  Advantages and five disadvantages of doubly linked lists

Write down atleast any five advantages and five disadvantages of doubly linked lists over singly linked lists in tabulated format

  Difference between an index and a discrete logarithm

Find the prime factorization of 7007. Also describe and show how you find it in step by step -  What is the difference between an index and a discrete logarithm?

  Short discussion on the concept of cryptography

The answer gives the learner with a short discussion on the concept of cryptography and the different aspects and functions that are provided through using encryption.

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