CSSE 230: Runtimes HW

Complete the following assignments from our book. Submit a scan of handwritten answers or a document edited by a wordprocessor. If you scan your solution, please ensure that the scan is legible. It will be hepful to use a black or dark-blue pen.

Notice: Please submit a pdf copy of your work and please place your name near the top of your document. Submissions that do not satisfy these two constraints will not be graded. Thank you.

  1. [3 pts] 5.11. Count the number of times x is multiplied.
  2. [16 pts] 5.20. Count the number of times sum++ is executed. Please provide an expression for the exact number of times. You do not need to run the code, nor provide a Big-Oh analysis.
  3. [4 pts] 5.21. Count the number of times sum++ is executed. Please provide an expression for the exact number of times. You do not need to provide a Big-Oh analysis.
  4. [18 pts] 5.29. You do not need to provide a Big-Oh analysis, instead provide the exact numbers of times the inner-most loop in each of the fragments is executed. Provide two answers for each fragment: for the best case and for the worst case.