CS210 Lab: Libraries and Running Time Measurement Postlab


Postlab Exercise:

This lab has shown that the nested loop in complexity.cpp is order n squared (or O(n²)). This exercise asks you to create code of different order and find the runtime.
  1. Modify the complexity.cpp code to find the running time for the following cases. Record the running time in milliseconds for:
    1. 0(n) a single "for" loop
    2. 0(1) an assignment statement
  2. What would you expect to happen with the run-time? Does this occur?


Back to Libraries and Running Time Measurement Lab click here

CS Dept Home Page
CS Dept Class Files
CS210 Class Files

Copyright: Department of Computer Science, University of Regina.