Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
- 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++;
}
}
}
- void fun2 (int n, int sum) {
int j = n;
while (j > 2) {
sum++;
j = j / 2;
}
}
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started