Partitioning algorithm and provide pseudocode

Assignment Help Basic Computer Science
Reference no: EM131240102

Recall that quicksort selects an element as pivot, partitions an array around the pivot, and recurseson the left and on the right of the pivot. Consider an array that contains many duplicates andobserve that for such an array, quicksort recurses on all duplicates of the pivot element. In this taskyou are to develop a new partitioning procedure that works well on arrays with many duplicates.The idea is to partition the array into elements less than the pivot, equal to the pivot and greaterthan the pivot.

(a) Develop this idea into a partitioning algorithm and provide pseudocode. Make sureyour algorithm is in-place (i.e., do not use more than a constant amount of extra space).

(b) Use your partitioning algorithm to come up with a sorting algorithm. Analyze theworst-case running time of your algorithm.

(c) Find an array on which the original quicksort runs in time Θ(n2) but your algorithmfrom (b) in Θ(n).

Reference no: EM131240102

Questions Cloud

How many different gelly roll pens are there : When redeeming a prize coupon, you may choose one of six charms and either one of three carabiners or one of two bracelets. How many different prize choices could you make?
What is your personal definition of leadership : What is your personal definition of leadership? You may include written text as well as visuals or graphics that help explain this definition. Support this definition from any research you have conducted, information gained from previous classes or s..
Compare and contrast the tcsec and the itsec standards : Compare and contrast the TCSEC and the ITSEC standards. Determine what features and practices should be included in the design and development of the chat program to qualify it for each of the four TCSEC classes.
What is a service level agreement : What is a service level agreement? How do device latency and memory affect performance? - How does a load balancing switch work?
Partitioning algorithm and provide pseudocode : Develop this idea into a partitioning algorithm and provide pseudocode. Make sureyour algorithm is in-place (i.e., do not use more than a constant amount of extra space).
How important is green it : Why do you think some organizations were slow to adopt a building-block approach to network design? - For what types of networks are network design tools most important? Why?
What factors might cause peak loads in a network : What factors might cause peak loads in a network?  - How can a network designer determine if they are important, and how are they taken into account when designing a data communications network?
How many supreme brunos could be ordered : The Supreme Bruno is any patty-with-a-vegetable burger plus a condiment (choose from Worcestershire sauce, wasabi sauce, or mustard); you can also have cheese, or not. How many Supreme Brunos could be ordered?
Sign and magnitude representation : 1) Using sign and magnitude representation, what is the largest positive number that can be stored in 8 bit? 2) If we record a song which is one minute long using 16-bit samples, sampled at 44.1 KHz in mono channel, without any metadata or compres..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Draw the portion of an asm chart

Draw the portion of an ASM chart that specifies a conditional operation to increment register R during state T, and transfer to state T2 if control inputs z and y are equal to I and 0, respectively.

  Evaluate the integral correct to four decimal places

Use your calculator to evaluate the integral correct to four decimal places

  Describe the outcome of their match

Jim and Tom played against each other in a golf tournament. Jim's final score was 6 under par, the average number of swings it should take a golfer to get his ball in the hole. Tom's score was 1under par. Describe the outcome of their match.

  Explaining communication methods which are beneficial

What additional communication methods not discussed in the reading do you believe are also beneficial? Explain what they are and how you know about them.

  Write a program to erase the first 100 words of the on-chip

Write a program to erase the first 100 words of the on-chip

  Filling weight for boxes of cereal

The filling weight for boxes of cereal is designed to have a variance .02 ounces or less. A sample of 41 boxes of cereal shows a sample standard deviation of .16 ounces. Use α .05 to determine whether the variance in the cereal box filling weight ..

  Write a program to test the new class

After writing the interfaces, create a collection class named StringCounter. It should implement the IOrderedWordStruture, mentioned above. It should have the following methods

  Derive an analog to the max-flow/min-cut theorem

Show how to solve this problem by first finding a feasible solution, and by then using a max-flow algorithm.

  Describes the internet protocol and includes two options

RFC 791 describes the Internet Protocol and includes two options for source routing. Describe three disadvantages of using IP source route options compared to using MPLS for explicit routing.

  Explain why the website is interesting

Explain why the website is interesting and describe its key features. Be sure to consider who wrote the information (do they have subject expertise and are they reputable?); does the author have any bias (what motives does the author have for writing..

  Prayer group reflection essay

Ministry requires discipline and ministers must grow in their spiritual lives through spiritual disciplines. Ministers must also know how to help those who are entrusted in their care to grow spiritually. Consider prayer group meeting on a weekly bas..

  Write a program that produces a list of nz notes and coins

Money dispenser calculatorWrite a program that produces a list of NZ notes and coins required to give change for a user-entered amount up to $1000.

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