1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jenyasd209 [6]
3 years ago
13

Write down a recurrence relation for this version of QuickSort, and solve it asymp-totically. Show your work. Assume that the ti

me it takes to find the pivot (eitherbest or worst, depending on the level of recursion) is Θ(n) for lists of lengthn.
Computers and Technology
1 answer:
torisob [31]3 years ago
5 0

Answer:As in merge sort, the time for a given recursive call on an n-element subarray is Θ(n). In merge sort, that was the time for merging, but in quicksort it's the time for partitioning.

Explanation:

Worst-case running time:

When quicksort always has the most unbalanced partitions possible, then the original call takes cncnc, n time for some constant ccc, the recursive call on n-1n−1n, minus, 1 elements takes c(n-1)c(n−1)c, left parenthesis, n, minus, 1, right parenthesis time, the recursive call on n-2n−2n, minus, 2 elements takes c(n-2)c(n−2)c, left parenthesis, n, minus, 2, right parenthesis time, and so on. cn+c(n−1)+c(n−2)+⋯+2c=c(n+(n−1)+(n−2)+⋯+2)

=c((n+1)(n/2)−1)

The last line is because 1 + 2 + 3 +...... n is the arithmetic series

Best-case running time:

Quicksort's best case occurs when the partitions are as evenly balanced as possible: their sizes either are equal or are within 1 of each other. The former case occurs if the subarray has an odd number of elements and the pivot is right in the middle after partitioning, and each partition has (n-1)/ 2 elements. The latter case occurs if the subarray has an even number n of elements and one partition has n/2 elements with the other having n/2-1.In either of these cases, each partition has at most n/2 elements.

Using big-Θ notation, we get the same result as for merge sort: Θ(nlog2n)

You might be interested in
Allie needs to add a long row of numbers. She should enter a
ikadub [295]
I believer the answere is a formula hope this helped
8 0
2 years ago
Read 2 more answers
Which of these is not a way of avoiding email fraud and scams?
Sever21 [200]

Answer:

"If you aren't sure if a link is legitimate, click it to see where it goes."

Explanation:

If you click on a unknown URL the host of the website can steal a lot of information from you computer. Like your geolocation  

7 0
3 years ago
20 points
adoni [48]
Yes it's important. It's like taking jotting down the ideas you have for a project, you don't want to forget anything, and these things help you keep track of what you want to do.

Answer would be false.
4 0
2 years ago
How to make your nest learning thermostat stop doing something
k0ka [10]

Answer:

You could unplug it? LOL

and get a different thermostat.

Explanation:

Could you mark this answer as brainiest?

Thanks! :)

4 0
3 years ago
What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
Airida [17]
the answer is A coaxial cable
8 0
3 years ago
Other questions:
  • ___ is a career discipline focusing on helping companies use computer technology effectively.
    12·1 answer
  • What's one way to engage teens in technology?
    8·1 answer
  • Face book requires you to change your password regularly<br> a. TRUE<br> b. FALSE
    14·1 answer
  • Which of the following events would most likely produce an earthquake
    7·1 answer
  • Advertising is organized around four distinct groups. The _____ group includes the photographers, the illustrators, video produc
    9·1 answer
  • What is the definition of digital literacy?
    7·2 answers
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
  • I AM GIVING BRAINLEST!!!!!!!!
    14·2 answers
  • write the definition of a class clock. the class has no constructors and one instance variable of type int called hours.
    12·1 answer
  • A project manager has designed a new secure data center and has decided to use multifactor locks on each door to prevent unautho
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!