How will you choose so that the modified algorithm

Assignment Help Computer Engineering
Reference no: EM132141255

Suppose PARTITION function of QUICKSORT algorithm always produces 9 : 1 proportional split (i.e., after partition, one sub-array contains n/10 elements and the other sub-array contains 9n/10 elements). To take advantage of the fact that insertion sort works really well on arrays of small size, suppose we make the following modification in QUICKSORT algorithm. Whenever any sub-array has k or fewer elements, we call INSERTION SORT and return the answer to the top level QUICKSORT call.

(a)Show that this modified algorithm runs in O(nk + n log(n/k)) time. ( Hint: How many times PARTITION function need to be called? How many times INSERTION SORT needs to be called? Note that worst case running time of INSERTION SORT on an array of n elements is O(n^2 ).)

b)How will you choose so that the modified algorithm will have O(n log n) running time? Show your work.

(c)Suppose PARTITION function always produces a split where one of the sub-arrays has exactly one element in it. In this case, what will be running time of the modified algorithm in terms of n and k? Can you choose an appropriate value of k so that the modified algorithm will run in O(n log n) time? Show your work.

Reference no: EM132141255

Questions Cloud

Compare the time for a query and response : Compare the time for a query and response for a complete DNS query and response (to all required nameservers) if M=1, M=2, and M=3.
How many 2 gb hard disks do you need if the hard disk : How many 2 GB hard disks do you need if the hard disk should store up to 70% of their capacity using RAID 0, RAID 1, RAID 3, or RAID 5.
What is the running time of your algorithm : What is the running time of your algorithm? Your program will take as input a file with edge information.
Write a program in c that shows the coach : Write a program in C that shows the coach, the total number of different pairs he can choose in the team.
How will you choose so that the modified algorithm : How will you choose so that the modified algorithm will have O(n log n) running time? Show your work.
How can we quickly test if k is even : We say that k is even if and only if |k| mod 2 = 0. How can we quickly test if k is even without using arithmetic operations, and without using mod?
Describe the ways in which this is an example of attacks : Suppose you are doing some online banking using your bank's website. An attacker has set up an active wiretap between your computer and your bank's server.
Forecasted an expected return : Using the data from problem 1, if you forecasted an expected return of 16.00% for stock XYZ, is it overvalued, undervalued, or fairly valued? Briefly, why?
Compare the time for a query and response for a complete : Compare the time for a query and response for a complete DNS query and response (to all required nameservers) if M=1, M=2, and M=3.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a procedure to fill the interior of a given ellipse

Write a procedure to fill interior of a given ellipse with a specified pattern. Define a procedure for changing size of an existing rectangular fill pattern.

  How are you going to connect the two computers

How are you going to connect the two computers? List as many possible solutions as you can, with the advantages and disadvantages of each.

  What is the instruction format class and why

Explain the operation of the 'MIPS andi ' instruction. Illustrate your answer with an appropriate example. In your answer you must provide details of the andi instruction format and of what each field in that instruction format does and how an and..

  Did you describe how they would deploy different software

scenario your boss has come to you and expressed that there are several software packages that he would like you to

  Write a script that uses three variables to store

Write a script that uses three variables to store (1) the count of distinct orders made in the Orders table (2) the total amount of sales.

  Describe basic operating system tools

Your boss has tasked you with installing and maintaining an operating system for a new employee. You will be re-using a computer formerly used by someone.

  How to write a c function named change()

The function should find the number of quarters, dimes, nickels, and pennies in the number passed to it and write these values directly into respective variables declared in its calling function.

  Demonstrates the code the use of references types

The program demonstrates in the code the use of references types. Comments and headers to explain processing that is not obvious.

  Explain methods whereby training materials can be delivered

Describe the methods whereby training materials can be delivered to the users of the software system. Explain the ways in which software can be supported after it is implemented/released.

  Find the corner points that describe the optimum solution

For the Reddy Mikks model, find the corner points that describe the optimum solution for each of the subsequent objective functions:

  Would you create multilingual capabilities for application

Would you create multilingual capabilities for any application that would be available to non-English speaking people? Think about Web sites that exist today.

  Identify three different classes that might contain objects

Identify three different classes that might contain each of these objects: Wolfgang Amadeus Mozart, My pet cat named Socks and Apartment 14 at 101 Main Street.

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