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]
4 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]4 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
In the Burp Suite Program that ships with Kali Linux, what mode would you use to manually send a request (often repeating a capt
Anna [14]

Answer:

Repeater

Explanation:

4 0
3 years ago
If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsA
Anvisha [2.4K]

Answer:

numAccounts = SavingsAccount.numberOfAccounts

Explanation:

In object oriented programming, when you have created an object of class, you can create several instances (objects) from that class by referencing the className.classFeild. In this instance SavingsAccount is the class name and

numberOfAccounts is a feild (or data member). to create a new numAccount, we use the syntax as above in the answer

3 0
4 years ago
To prevent unauthorized access and use, at a minimum a company should have a written __________ that outlines the activities for
Maru [420]

Answer:

a. acceptable use policy (AUP)

Explanation:

An acceptable use policy (AUP) is a document where everyone has to sight it before to receive access to a company's network.

Employees or students have to sight politics like:

- Never try to break the security system.

- Never posting commercial content.

- Never send spam.

- Report any suspicious behavior.

3 0
4 years ago
Comments should be written in what type of language
jeyben [28]
Comment should always be answered in the prospective language the question is asked.
8 0
4 years ago
Astrid’s computer screen suddenly says that all files are now locked until money is transferred to a specific account, at which
monitta

Answer:

Your answer would likely be ii

Explanation:

Most of the time these types of programs will behave like the one stated. They normally want you to pay with Bitcoin but it can vary like with Ethereum or really anything that's in the stock market! But it normally consists of Bitcoin

6 0
3 years ago
Other questions:
  • A School is interested in computerizing their students<br />grading system.<br />I Marks Grade<br />150-100 A&
    11·1 answer
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    8·1 answer
  • Where may an operating system reside in a mobile device?
    5·1 answer
  • Need help with photography
    12·1 answer
  • What is information associated with a document to help describe that document called?
    14·1 answer
  • Edhesive 1.7 code practice question 1
    8·1 answer
  • which driver must be running and configured to enable a PC to communicate with a CompactLogix PLC on an Ethernet network
    10·1 answer
  • Choose the item which best describes the free frame list. 1. a per process data structure of available physical memory 2. a glob
    7·1 answer
  • What are the different Stape of data processing cycle?​
    8·1 answer
  • A large retail company hires several new joiners and would like to incorporate Virtual Reality (VR) into their onboarding proces
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!