Take 3 temporary elements ...
Max1 , max2, max3
Now make 0th element as max1 check with all elements when when max1 changes put previous value of max1 into max2 ...
Now second time max1 changes that means new greater element has been found...
Puprevious max1 into max 2 and previous max2 value into max3...
Now this process repeated till the end of array...
Which take O(n) time...