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
weeeeeb [17]
3 years ago
8

Use Quicksort algorithm to sort the following list of random numbers. Show all steps. Derive the time complexity of Quicksort an

d find the asymptotic notation using master theorem.
3 | 4 | -2 | 8 | 10 | 5 | 0 | 7 | 12 | 14 | 9 | 6 | 8 |1 | 5
Computers and Technology
1 answer:
Zigmanuir [339]3 years ago
6 0

Answer:

Quick Sort is a Divide and Conquer algorithm which picks an element as a pivot which divide the array into two halves.

Sorted Array -2 | 0 | 1| 3| 4| 5 | 6| 7 | 8| 9 |10 | 12 |14| now array is sorted

Time Complexity of Quick Sort = = O ( n log n )

asymptotic notation using master theorem = T(n) = aT (n/b) + θ ( n^k log^p n)

Explanation:

Quick Sort is a Divide and Conquer algorithm which picks an element as a pivot which divide the array into two halves. There are many types of Quick Sort as

  •  Pick the first element as pivot
  • pick the last element
  • pick random element
  • pick median element

3 | 4 | -2 | 8 | 10 | 5 | 0 | 7 | 12 | 14 | 9 | 6 | 8 |1 | 5 //5 as a pivot

-2 | 3 | 4| 8| 5| 0| 7 |10 |12| 14 | 9 | 6 | 1| 5| 8 //8 as pivot

-2 | 0 | 1| 3| 4| 5 | 6| 7 | 8| 9 |10 | 12 |14| now array is sorted

here pick a point as initial values first pick 5 as pivot then compare the 5<values if it id true then swap it of it is false move towards next and check the condition. Similarly half array is sorted pick 8 as pivot point then do the same procedure and sort the other half array.

Time Complexity of Quick Sort

T(n) =a

= 2T(n/2) + n

= 2( 2T (n/4) + n/2) + n

= 2² T (n/2²) +n +n

= 2² (2t(n/2³)+n/4 ) +n +n

= 2³T (n/2³) + n +n +n

= 2^k T ( n/ 2^k) + nk

= nT( n/n ) + n log n

= na + n log n

= O ( n log n )

asymptotic notation using master theorem.

T(n) = aT (n/b) + θ ( n^k log^p n)

a = number in the recursion and a >= 1

n/b = size of each sub problem

b > 1, k >= 0 and p is a real number.

You might be interested in
What will you better be prepared for by learning about the animals you photograph
krek1111 [17]

D. All of the above.

Makes the most sense! :3

6 0
3 years ago
Pls awnser if awnser is wrong I will unmark brainliest
choli [55]

Answer: i think 1, 3, and 4

Explanation:

3 0
3 years ago
What term is used to describe a list of security policies that is associated with an object?
Artemon [7]

Answer:

An Access control list (ACL) is used to describe a list of security policies that is associated with an object

5 0
4 years ago
What's the drawback of using Screened Subnet (DMZ)?
lesantik [10]

It's more expensive, it's more difficult to configure and maintain and it can be more difficult to troubleshoot

4 0
4 years ago
in the world of computing accessibilty most often refers to: a how quickly software opens , b password protection, c assistance
Wittaler [7]
C. assistance for the disabled
8 0
3 years ago
Other questions:
  • You are trying to appreciate how important the principle of locality is in justifying the use of a cache memory, so you experime
    11·1 answer
  • Write a function in MATLAB that takes as an input a matrix of coefficients for a system of linear equations (A), the solution ve
    15·1 answer
  • By generating and delivering timely and relevant information supported by networks, _____ creates new opportunities for conducti
    15·1 answer
  • A c++ member function that uses, but does not change, the value of a member variable is called
    13·1 answer
  • The biggest factor in determining the price of a mortgage is:
    14·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • The term that refers to the standard computer language for creating web pages is called:
    6·1 answer
  • Who is gossip girl.....
    8·2 answers
  • You are moving to an area where DSL will be available in the next six months. Which method of internet connectivity should you i
    13·1 answer
  • Is there an air flow through the house? if so, does the air flow in the window and out the chimney, or in the chimney and out th
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!