Question
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
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