We thus can compute the values of xi , in increasing order from I = 1 to n. xn is the value we want , and we can compute sn by tracing back through the computations of the max operator. Since we spend constant time per iteration , over n iterations, the total running time s O(n).