Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2006 | Question 17

  • Last Updated : 10 Jul, 2018

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.
(A) Solves it in linear time using a left to right pass of the array
(B) Solves it in linear time using a right to left pass of the array
(C) Solves it using divide and conquer in time Theta(nlogn)
(D) Solves it in time Theta(n^2)


Answer: (B)

Explanation: Please see this post for explanation.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :