CS210 Lab: Libraries and Running Time Measurement Prelab Answers
Prelab Answers:
For each of the following code fragments, specify the Big O expressions:
-
int a;
a=b;
O(1)
-
for (int i=0; i<n; i++)
array[i]=0;
O(n)
-
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
Copyright: Department of Computer Science, University of Regina.