We show that the sum of a sequence of integers can be computed in linear time on a Turing machine. In particular, the most obvious algorithm for this problem, which appears to require quadratic time due to carry propagation, actually runs in linear time by amortized analysis.
翻译:我们证明,在图灵机上,整数序列的和可以在线性时间内计算。特别地,针对该问题最显然的算法——由于进位传播看似需要二次时间——实际上通过平摊分析可以在线性时间内运行。