Answered step by step
Verified Expert Solution
Link Copied!

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.

  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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

LO1 Discuss four different views of motivation at work.

Answered: 1 week ago

Question

LO6 Summarize various ways to manage retention.

Answered: 1 week ago