A concrete example(HW1, part 2)
Assume that we have a string package in which concatenating two strings takes O(length(result)) time.
How long does the following loop take?
s = “”;while (--n >= 0) s = s + x;
Previous slide
Next slide
Back to first slide
View graphic version