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
Feature of electric circuit​
Ksenya-84 [330]

Answer:

Question:

What are the three basic features of an electric circuit?

Answer:

All electric circuits must have Devices or resistors that are run by electric energy, a source of electrical called voltage -battery, generator, connected by conducting wires

3 0
3 years ago
Read 2 more answers
The extension name of a java bytecode file is ________.
GrogVix [38]
Class










------------------------------------
7 0
4 years ago
All of the following are guidelines for maintaining an engineering notebook EXCEPT
gayaneshka [121]

C) numbering pages at the bottom inside corner

An Engineering notebook is a legal document made of bound, grid paper where engineers formally document written ideas, sketches, work session summaries, research findings and interview information in chronological order.

When not in use, the notebook should be stored in a safe location with each page dated and signed.

There will absolutely no situation where a page is removed.

All entries should start at the top of each page and ending at the bottom. Supporting material should be permanently affixed.  

Book pages should be numbered on the top right side of the page.  


6 0
3 years ago
What does HTML stand for?
Wittaler [7]

Hypertext Markup Language

5 0
3 years ago
Read 2 more answers
What type of document is a mobile device's EULA?
MakcuM [25]
EULA stands for End User License Agreement. This document is the contract between the software application author or publisher and the user of that application. It is also called "software license", because it establishes the purchaser's right to use the software on the mobile device. T<span>he user agrees to pay for the privilege of using the software, and promises the software author or publisher to comply with all restrictions stated in the EULA. </span>
6 0
3 years ago
Other questions:
  • PowerPoint Presentation on What type of device will she use to display her presentation and explain it to the rest of the childr
    13·2 answers
  • Read the Security Guide about From Anthem to Anathema on pages 238-239 of the textbook. Then answer the following questions in t
    14·1 answer
  • The early success of Microsoft was cemented by the release of which software product:
    12·1 answer
  • UDAL Pretest: Using Digital Cameras 15 Select the correct answer. Which mode of shutter speed helps to capture creative effects
    6·1 answer
  • Which of the following is not System Software?
    5·1 answer
  • You are a Data Scientist at Anthem Blue Cross Blue Shield. You want to check if a patient will develop diabetes. Please write th
    5·1 answer
  • Explain the four misconceptions about entrepreneurship.
    7·1 answer
  • Write a SELECT statement that returns the same result set as this SELECT statement. Substitute a subquery in a WHERE clause for
    13·1 answer
  • PLZZZZ HELP!!!
    12·2 answers
  • Which best describes sorting, filtering, and deleting records?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!