Question: CPSC 2430 Data Structure Fall Quarter 2021 Assignment #1 is to practice your understanding of Big O and recursion. Task 2. For each code fragment

CPSC 2430 Data Structure

Fall Quarter 2021

Assignment #1 is to practice your understanding of Big O and recursion.

Task 2.

For each code fragment below, indicate its Big O.

  1. void fun1 (int n, int sum) {

for (int i = 0; i < n * 100; ++i) {

for (int j = n; j > 0; j--) {

sum++;

}

for (int k = 0; k < i; ++k) {

sum++;

}

}

}

  1. void fun2 (int n, int sum) {

int j = n;

while (j > 2) {

sum++;

j = j / 2;

}

}

  1. void f3 (int n) {

for(int i=0; i < n; i++) {

for(int k=0; k < n; k++) {

for(int m=0; m < 10; m++) {

cout << This is assignment 1 for CPSC 2430 WQ 2022 << endl; }}}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!