Which of the following algorithm design approach is used in Quick sort…

2022

Which of the following algorithm design approach is used in Quick sort algorithm ?

  1. A.

    Dynamic programming

  2. B.

    Back Tracking

  3. C.

    Divide and conquer

  4. D.

    Greedy approach

Attempted by 793 students.

Show answer & explanation

Correct answer: C

Answer: Quicksort uses the divide and conquer approach.

How it applies:

  • Choose a pivot and partition the array into elements less than the pivot and elements greater than the pivot.

  • Recursively apply the same process to the left and right partitions.

  • After recursion finishes, the entire array is sorted (no separate merge step is required).

Why the other approaches do not apply (brief):

  • Dynamic programming: requires overlapping subproblems and memoization; quicksort divides into independent subproblems instead.

  • Backtracking: explores and abandons partial solutions under constraints; quicksort does not perform such search.

  • Greedy approach: makes locally optimal choices to build a solution; quicksort's partition-and-recurse pattern is not a greedy construction.

Complexity and characteristics:

  • Average time complexity: O(n log n).

  • Worst-case time complexity: O(n^2) (can be avoided with good pivot choice such as randomized pivot or median-of-three).

  • Space: typically O(log n) average due to recursion (in-place partitioning), though worst-case recursion depth can be O(n).

  • Stability: standard quicksort is not stable.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Coding For Placement