Previous large element
Sorry for the bad formatting,
What I want to do is
Suppose an array given is
79 23 1 11 19 58 2
for each element , I want to find the left most element greater than that element
So,
for 23 it is 79
for 1 it is 23
for 11 it is 23 and so on..
I thought of iterating from the end and finding the element greater(naming it max) than last element and then all the elements between max and last element will have their max element as max. So less number of comparison.
Please correct me if I am wrong ..
Thanks for the help.
it seems you copy pasted this from somewhere else. It's not properly formatted and it's not clear what the question is about.
- Miguel Oliveira September 03, 2013Try to be a bit more clear about the objective and give one or 2 examples of input and output