Compare the running time of this modification

Assignment Help Basic Computer Science
Reference no: EM13166941

Implement the following modification of the quick sort algorithm, due to Bentley and McIlroy. Instead of using the first element as the pivot, use an approximation of the median. (Partitioning at the actual median would yield an O(n log(n)) algorithm, but we don't know how to compute it quickly enough.)

If n < or = 7, use the middle element. If n < or = 40, use the median of the first, middle,
and last element. Otherwise compute the "pseudomedian" of the nine elements a[i * (n - 1) / 8], where i ranges from 0 to 8. The pseudomedian of nine values is med(med(v0, v1, v2), med(v3, v4, v5), med(v6, v7, v8)).

Compare the running time of this modification with that of the original algorithm on sequences that are nearly sorted or reverse sorted, and on sequences with many identical elements. What do you observe?

Reference no: EM13166941

Questions Cloud

The minimal spanning tree algorithm : discuss the minimal spanning tree algorithm. Describe the advantages and disadvantages of this algorithm. List the circumstances best suited for the minimal spanning tree algorithm.
Each has a string for their name : Create a class in C++ that holds robot warriors. Each has a string for their name, a number of hitpoints (an float), armor (a defensive modifier(an int)), and weaponry (an offensive multiplier(another int)). You will create 5 robots with a random ..
Select distinct cmdclient : SELECT DISTINCT CMDclient.'Client Code SCA' as GuestCode, CMDextras.ArrivalDate as arr, CMDextras.DepartureDate as dep, CMDapr.FirstName as fname, CMDapr.Surname as lname
Find the value of (((a+b+)+c)+d) : find the value of (((a+b+)+c)+d) that would be computed in a floating point number system that has a mantissa approximately equivalent in precisions to 17 decimal digits. a = 99.0, b = 1.0*10^30, c=1.0*10^30, d = -98.0
Compare the running time of this modification : Compare the running time of this modification with that of the original algorithm on sequences that are nearly sorted or reverse sorted, and on sequences with many identical elements. What do you observe?
Putting objects within objects is the essence of composition : Putting objects within objects is the essence of composition. It is called composition for obvious reasons. As we always say that if something is made from other things that it is composed from those things.
Compare video, voice, and data formats. : Compare video, voice, and data formats. Identify at least three bandwidth techniques and how you would manage them with either UDP or TCP protocols
Create an employee class. : Create an Employee class. Items to include as data members are employee number, name, date of hire, job description, department, and monthly salary.
Manual park button and the application accurately : As an application tester, I want to press the manual park button and the application accurately records the location of the intended vehicle. The ratio of successes to failures will be recorded to report to the development team.

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Why is it necessary to include both wmfc and mfc

Why is it necessary to include both WMFC and MFC in the logic expression for Counter_enable given in Section 5.6.2?

  Access and its limitations in distributed business model

describe the difference of the two terms and how they work together. Your post should include the following details: A description of Access and its limitations in a distributed business model.

  Government imposes below-equilibrium price ceiling on market

If the government imposes the same below-equilibrium price ceiling on all these markets, which of the following statements will be true?

  Select three imaging tools and explain their functions

Choose three imaging tools and describe their functions, including those of their subtools. Provide examples of how these tools might be used to enhance your professional or personal photos.

  Methods-majority of target audience can play applications

What are some methods that we can guarantee that majority of target audience can play applications?

  What dangers would you warn against?

Under what factors would you recommend that an organization store information outside of its system? What dangers would you warn against? What recommendations could you provide to address the dangers?

  Explain diagnosing and troubleshooting excel-based problems

How does versatility of Excel affect application support? Because of its versatility, write assumptions should be made when diagnosing and troubleshooting Excel-based problems?

  Function in programs to print upside down triangles

Apply function in programs to prints triangles, upside down triangles, and diamond.

  Support desktop computers in small company

Static IP address of server is 192.168.45.200. Employees will open their Web browser and enter personnel.mycompany.com in URL address box to browse Web site.

  The initialization program

The initialization program will start with how much you have in the cash register and in what denominations the money is in.

  For hypothetical insurance company

for hypothetical insurance company. This company offers insurance for 4 types of vehicles: cars, trucks, motor cycles and boats.

  Whena router encounters

Whena router encounters an error in an IP header it:  a.returns the packet to the sending router. b. returns the packet to the sending router with an error advisement.

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