Next Greater Element | GeeksforGeeks Given an array, print the Next Greater Element (NGE) for every ...

Please Visit: http://ift.tt/1ajReyV



Next Greater Element | GeeksforGeeks

Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element on the right side of x in array. Elements for which no greater element exist, consider next greater element as -1.

Examples:

a) For any array, rightmost element always has next greater element as -1.

b) For an array which is sorted in decreasing order, all elements have next greater element as -1.

http://ift.tt/UtFbi4

http://ift.tt/UtFbi6



Next Greater Element | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lYb0oQ

via LifeLong Community

No comments:

Post a Comment