Open In App

GATE | GATE-CS-2006 | Question 17

Like Article
Like
Save
Share
Report

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


Last Updated : 10 Jul, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads