Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the big-O for the following program? for i in range(N): a = a + 5 for i in range(N): b = b +

What is the big-O for the following program?

for i in range(N):

a = a + 5

for i in range(N):

b = b + 10

1). O(1)

2). O(N)

3). O(N^2)

4). O(N^3)

5). O(2^N)

6). O(N!)

What is the big-O for the following program assuming N is the number of elements?

for i in range(100,N): for j in range(j,N):

for k in range(N-100)

x=i*j*k

1). O(1)

2). O(N)

3). O(N^2)

4). O(N^3)

5). O(2^N)

6). O(N!)

Which will take too long to compute, even for reasonably sized values of N?

1). O(1)

2). O(N)

3). O(N^2)

4). O(N^3)

5). O(2^N)

6). O(N!)

Given a Big-O of O(N^3), what is N?

- N^3

- number of elements

- time

- upper bound

- lower bound

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions