Question

In: Computer Science

We saw that Quicksort actually won’t be “quick” when it attempts to sort some types of...

We saw that Quicksort actually won’t be “quick” when it attempts to sort some types of inputs (e.g., it will take O(n2) time to sort n numbers that are already sorted). List two different ways to improve Quicksort so that it will run “quickly” (on average, in linear time) regardless of the characteristics of the input pattern.

Solutions

Expert Solution

Dear Student I understand your problem and will give you most of the information about different ways to improve Quicksort so that it will run “quickly”.Please go through the information given below and try to interpret with the given information you will surely get the best answer possible.

The quicksort calculation is effortlessly parallelized. On the off chance that you have different centers to work with, you could see a lot of accelerate. Contingent upon how enormous your informational collection is, it could undoubtedly give you more accelerate than some other improvement. In any case, in the event that you have just a single processor or a moderately little informational index, there won't be a very remarkable accelerate.

I could expand more if this is a chance.

OR probably expanding and giving you a simplest explanation with the possible ways......

  1. Pick a superior pivot: eg. in median of-three you pick 3 (arbitrary) components and pick the pivot the middle component
  2. When length(a[]) < M (practically speaking pick M = 9) quit arranging. After qsort() completed apply embed sort which would take generally M * N = O(N). This dodges many capacity calls near leaf of the separation et-impera recursion tree.

Dear Student by these explanation and the points mentioned I hope your question is answered .Hope you like it.


Related Solutions

If quicksort is so quick, why bother with anything else? If bubble sort is so bad,...
If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many different sorting algorithms? Your task is to investigate these and other questions in relation to the algorithms selection sort, insertion sort, merge sort, and quicksort. Write a set of guidelines for each algorithm to help someone decide which one would be most appropriate for a particular situation. Include in your guidelines a...
Can someone implement the following in Java? Quicksort with switching to Insertion sort when the number...
Can someone implement the following in Java? Quicksort with switching to Insertion sort when the number of elements in the subarray is less than or equal to 2% of the original number Requirements: 1) functions from standard libraries implementing Quicksort are NOT allowed;
6. The worst case scenario in the quick sort occurs when the array is partitioned to...
6. The worst case scenario in the quick sort occurs when the array is partitioned to two equal sized subarray every time that a recursive call takes place. True False 7.Suppose that we want to sort an array of n elements, where each element is a string of at most 1000 characters. What is the time requirement for applying radix sort to sort this array? O(n2) O(1000n) O(l000logn) O(nlogn) 8.Suppose we want to sort the following array of integers using...
When a fuze ( note this spelling) of some sort is ignited it will burn or...
When a fuze ( note this spelling) of some sort is ignited it will burn or deflegrate ( be sure you know the difference) In some cases when then the chemical composition of the fuze material is a propellant or even an explosive of some type the fuze will transition to a detonation within that material. The question is what attributes of the the material - Chemical and Geometric - will govern if or how or how quickly the material...
Below are some unusual types of bonding, or unexpected types of structures, that we have encountered...
Below are some unusual types of bonding, or unexpected types of structures, that we have encountered in this module. Provide one or two examples of compounds that exhibit each of the following unusual or unexpeced behaviors; be sure to provide examples for each of the possibilities: A. Partial multiple bonding B. Unexpected strength in a single bond C. Electron-deficient bonding (or, 3-centered-2-electron bonding) D. A main group (s or p-block) metal that forms more than one stable oxidation state. E....
Samantha was leery about door-to door selling but saw some tremendous income potential when she joined...
Samantha was leery about door-to door selling but saw some tremendous income potential when she joined the Good Health Filter Company (GHFC). She thought, “With all the hullabaloo about air pollutions and its contribution to ill health, these filters should be a cinch to sell.” GHFC manufactured furnace air filters and claimed that they would reduce indoor air pollutions by 90%. The company chose to distribute its products directly to homeowners so salespeople could deliver a standardized sales presentation. During...
When valuing companies we typically look at transaction multiples (what companies were actually sold for) or...
When valuing companies we typically look at transaction multiples (what companies were actually sold for) or public market multiples. What are some potential pitfalls of using average multiples? Question 20 options: Companies may not be as similar as the multiples would suggest. Competitive position may vary widely. Margins and returns may vary widely. All of the above.
There is no doubt we all have some strategies or techniques we use when we want...
There is no doubt we all have some strategies or techniques we use when we want to persuade others. There is something you want...or something you want someone to do. Maybe you're trying to change someone's opinion or the way they think. What is your preferred technique or strategy? Why does it work for you? Will it work in a formal persuasive speech? You already use persuasive techniques...let's talk about them.
We have discussed several types of shoring. If we have a certain project, when should we...
We have discussed several types of shoring. If we have a certain project, when should we do the shoring using sheet piles, Contiguous Piles, Secant Piles, Soldier Beams and Lagging, or Diaphram Walls? Compare between these different types and list the criteria at which we choose the appropriate shoring system for any project.We have discussed several types of shoring. If we have a certain project, when should we do the shoring using sheet piles, Contiguous Piles, Secant Piles, Soldier Beams...
2) Name some types of resistance welding and discuss some design considerations when making them.
2) Name some types of resistance welding and discuss some design considerations when making them.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT