An element in an array X is called a leader if it is greater than all elements…

PYQ GATE 2006

An element in an array X is called a leader if it is greater than all elements to the right of it in X. The best algorithm to find all leaders in an array.

  1. A.

    Solves it in linear time using a left to right pass of the array

  2. B.

    Solves it in linear time using a right to left pass of the array

  3. C.

    Solves it using divide and conquer in time Theta(nlogn)

  4. D.

    Solves it in time Theta(n^2)

Attempted by 263 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…