Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please answer the three parts of this before Friday? Problem 2 Determine the tightest upper and lower bounds for each of the following

Can someone please answer the three parts of this before Friday?

Problem 2

Determine the tightest upper and lower bounds for each of the following pieces of pseudocode and provide a brief explanation for your answers. Give your answers in big-Omega and big-Oh notation and in terms of N . You can assume that N is a relatively large number.

(a) int sum = 0 for (int i = N ; i > 0; i = i / 3) for (int j = 0; j < 2 i ; j ++) sum ++ end for end for

(b) int count = 0 for (int i = 1; i < N ; i = i * 2) for (int j = 1; j < N ; j = j + 2) count ++ end for end for while ( count > 0) count = count - 1 end while

(c) int i = 1 while ( i < N ) int num = random (100)//a random number from from 1 to 100 if ( num % 2 == 0) i = i + 5 else i = i * 3 end if

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago