Homework, part 2
Assume you're using a programming language that supports strings, in which evaluating s+t takes O(len(s)+len(t)) time. How long does this loop take?
s = ``'';
while (--n >= 0)
s = s + x;
Prove it.
Previous slide
Next slide
Back to first slide
View graphic version