Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91761134
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question suppose that x 00271 and y 608 are correctly

Question : Suppose that x* = 0.0271 and y* = 6.08 are correctly rounded versions of x and y to 3 digit mantissas. The smallest interval [a,b] that would contain x is [0.02705, 0.02715] since 0.0271 is between those numbe ...

What are some skills individuals who work in the field of

What are some skills individuals who work in the field of cyber security need to prevent hacks in to a company's computers?

How do you calculate the annual interest rate of 12

How do you calculate the annual interest rate of 12% compounded monthly. I know how to do for annually but not monthly. You are offered the opportunity to put some money away for retirement. You will receive 10 annual pa ...

Question when you supervisor arrives she has a document

Question : When you supervisor arrives, she has a document with her for you to sign, indicating the condition of the computer, how you kept it secure while you waited for her, and the transfer of responsibility for the c ...

Recommend a mechanism that will record event data on the

Recommend a mechanism that will record event data on the folders for each department. What events should be logged and how often do these logs need to be reviewed? Recommend an implementation for antivirus software. Sugg ...

Question suppose you want to back up a huge file to a cd-r

Question : Suppose you want to back up a huge file to a CD-R. You can do this by splitting the file into smaller pieces and backup up those pieces separately. Write a utility program named FileSplitter that splits a larg ...

Suppose pointers are 4 bytes long and keys are 12 bytes

Suppose pointers are 4 bytes long, and keys are 12 bytes long. How many keys and pointers will a block of 16,384 bytes have?

Discuss how a successful organization should have the

Discuss how a successful organization should have the following multiple layers of security in place for the protection of its operations: Information security management. Data security Network security

Question 1 describe and explain the role and function of

Question: 1. Describe and explain the role and function of network connectivity in current computing. 2. Describe and explain the protocols and interactions that implement network communications. 3. Describe and explain ...

Consider a tcp connection between two hosts that are 400

Consider a TCP connection between two hosts that are 400 miles away from each other (propagation delay is 100 miles per msec.). Assume that there is no error or loss in this communication and the receive window size is s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As