Corrected algorithm complexity