2. Write the big-O expression to describe the number of operations required for the following two pieces of code. You need to explain your solution and show your work. (3 points)
code 1:
counter = 0
for (i = 1; i < n; ++i) {
for (j = 1; j < i; j++) {
counter++;
}
}
code 2:
counter = 0;
for (i = 1; i < n; ++i) {
for (j = 1; j < n^3; j++){
counter++;
}
}
CODE 1 :
CODE 2 :
Get Answers For Free
Most questions answered within 1 hours.