Let P be a quicksort program that sorts numbers in ascending order using the…

PYQ Hexaware Hiring Assessment 2024

Let P be a quicksort program that sorts numbers in ascending order using the first element as the pivot. Let t1 and t2 be the number of comparisons made by P for the inputs [1, 2, 3, 4, 5] and [4, 1, 5, 3, 2] respectively. Which one of the following holds?

  1. A.

    t1 = 5

  2. B.

    t1 < t2

  3. C.

    t1 > t2

  4. D.

    t1 = t2

Attempted by 62 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…