CS210 Lab: Libraries and Running Time Measurement Prelab Answers


Prelab Answers:

For each of the following code fragments, specify the Big O expressions:
  1. int a;
    a=b;
    O(1)

  2.  
  3. for (int i=0; i<n; i++)
          array[i]=0;
    O(n)

  4.  
  5. for (int i=0; i<n; i++)
          for (int j=0; j<n; j++)
                a++;
    O(n²)

Back to Exercise click here
Back to Libraries and Running Time Measurements Lab click here

CS Dept Home Page
CS Dept Class Files
CS210 Class Files

Copyright: Department of Computer Science, University of Regina.