hi the number should be just next higher element or any higher element

like
if my arr is like

arr= 2 5 1 3 7 6
 the next higher element for 5
 should be what (7 or 6 )  because 6 is more closer to 7 but 7 comes first
in arr

On Wed, Jun 23, 2010 at 11:18 AM, Raj N <rajn...@gmail.com> wrote:

> Design a data structure to find the next higher element for each
> element in an array.
> For e.g. if array is 1 2 3 4 5 8 6
> o/p should be
> (element) (next higher element)
> 1 2
> 2 3
> 3 4
> 4 5
> 5 8
> 8 nothing
> 6 nothing
>
> The array need not be sorted.
> Constraints-O(n) time complexity
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Kumar Vishal
____________________________
StAy HunGrY , StAy fOOlisH
____________________________
Contact No:- 09560193839

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to