Sunday, November 17, 2024
Google search engine
HomeData Modelling & AIAlgorithms | Sorting | Question 17

Algorithms | Sorting | Question 17

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as a pivot using an O(n) time algorithm. What is the worst-case time complexity of the quick sort?

(A) \\theta (n)

(B) \\theta (n*log(n))

(C) \\theta (n2)

(D) \\theta (n2 log n)

(A)

A

(B)

B

(C)

C

(D)

D

Answer: (B)
Explanation:

The recursion expression becomes: T(n) = T(n/4) + T(3n/4) + cn After solving the above recursion, we get \\theta (n*log(n)).

Quiz of this Question
Please comment below if you find anything wrong in the above post

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments