Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Assume that you have a special routine that, given an array of size n, uses no comparisons to return the index of a

   

1. Assume that you have a special routine that, given an array of size n, uses no comparisons to return the index of a random element whose value is in the middle third of the array. So the value of this element is between the n/3+1th and 2n/3rd smallest, inclusive. Assume that you execute quicksort with the help of this routine. (a) Estimate the number of comparisons that quicksort now uses assuming that the 5n/12th smallest element is always picked by this routine. Just get the high order term. (b) Find the high order term for the number of comparisons that quicksort now uses. To simplify the computation, you may assume that the size of a sublist is always a multiple of 3, and you may modify your summation bounds a small constant amount, but state when and how you do so. (c) Compare your estimate from Part (a) with the actual value for the high order term from Part (b).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a To estimate the number of comparisons that quicksort uses when the 5n12th smallest element is always picked by the special routine we need to determine the recursion depth and the number of comparis... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Contemporary Auditing

Authors: Michael C. Knapp

8th edition

978-0538466790, 538466790, 978-1285066608

More Books

Students also viewed these Programming questions