Algorithm to find Max and Min in an array with complexity 1.5*n