Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. what is the Big-O performance of the following function? def sum(n): k = 0 for i in range(n): for j in range(n): k =

1. what is the Big-O performance of the following function? def sum(n): k = 0 for i in range(n): for j in range(n): k = k + n return k

a. O(1) b. O(n) c.O(n2) d.O(log n)

2. what is the Big-O performance of the following function? def sum2(n): i = n k = 0 while i > 0: k = k + 1 i = i // 2 return k

a. O(1) b. O(n) c.O(n2) d.O(log n)

3. what is the Big-O performance of the following function? def sum(n): k = 0 j = 0 while k < n: k = k + 1 while j < n: j = j + 1 k = k + j return k

a. O(1) b. O(n) c.O(n2) d.O(log n)

4. what is the Big-O performance of the following function? def sum3(n): k = 0 for i in range (n): k = k + i for j in range (n): k = k - j return k

a. O(1) b. O(n) c.O(n2) d.O(log n)

5.what is the Big-O performance of the following function? def sum3(n): k = 0 for i in range (n): k = k + i return k

a. O(1) b. O(n) c.O(n2) d.O(log n)

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago