Due: Wednesday, Nov 2nd by 11:59 PM

Your Task

Do exercise 5.20 on page 220, part (a) only. You just need to analyze each code fragment to find a big-O upper bound on its running time. You do not need to implement or benchmark the code fragments.

For each code fragment, explain how you arrived at the big-O upper bound.

For example, for the first code fragment: "the body of the loop executes in constant time, and the loop executes exactly n iterations, so the overall running time is O(n)".


Save your answers in a plain text file or a PDF file. Submit to marmoset as assign5:


Important: Do not submit a file in any format other than plain text or PDF.

Important: After you submit your file, download it and check to make sure it is what you intended to submit.

I may assign a grade of 0 for incorrectly submitted assignments.