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

  Explain object-oriented analysis and agile methodologies

Distinguish the object-oriented analysis and create models with structured analysis and design models. Write down Agile Methodologies?

  Explain specific challenges of facing designer

Explain specific challenges of facing the designer, specifically with regard to limitations of hardware, software and interface design two paragraph each.

  Analysis of executive management team

Give a one to two page analysis summarizing the results to the executive management team of Omega.

  Cloud computing to the rescue

Cloud computing provides scalable computing resources, software applications, data storage, and networking infrastructure at cost below what would cost an organization to provide an equivalent infrastructure internally.

  Client-server computing from file server

Discuss the evolution of client-server computing from file server to multilayer applications to Web-based applications. What has been the driving force causing this evolution? Where do you think network computing will be in the next five years? Ten y..

  Implementing strong password policy

How do you implement strong password policy given dilema of forgotten passwords? How would you address these issues?

  Dis-assemble each of the following

Dis-assemble each of the following MIPS R2000 object code into source code instructions. Use register names, such as $t2, instead of numbers, such as $20.

  Networks are fundamental

Networks  are  fundamental  to  every  aspect  of  our  society.  Designing  a  network  that  is  both  adequate  to  current  and  future  needs  is  important.

  Write a computer program to compute the number of components

Write a computer program to compute the number of components, average/max tail length, min/average/max cycle length when we use h 16 (x), where h(x) is MD5, and 16 indicates we are using the least significant16 bits of MD5. Use C++.

  Describe basic computer system and typical components

Describing the basic computer system and the typical components that perform input, output, processing, storage, and control functions.

  Write the definition of a method

Write the definition of a method , isReverse , whose two parameters are arrays of integers of equal size. The method returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.)

  Find minimum associativity needed of level cache

Determine the minimum associativity needed of the level 1 cache for consistent performance independent of both arrays' position in memory?

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