Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(2) Consider the following pseudo-code for a function that takes, as input, a parameter N: Function F(N) Loop i from 1 to N2 if F1(N)

image text in transcribed

(2) Consider the following pseudo-code for a function that takes, as input, a parameter N: Function F(N) Loop i from 1 to N2 if F1(N) F2 (N) else Loop j from 1 to N F3 (N) if F4(N) Loop k from 1 to N F5 (N) else F6 (N) For each of the following assumptions, analyze the worst-case running time of Function F using Big-Oh notation, Big-Omega notation, and Big-Theta notation, if possible. Express all answers using the tightest possible bounds. Briefly explain your answers! Note: In class, we went over rules related to Big-Oh notation. You will have to infer similar rules for the other notations. Assume that function F1 returns a Boolean value. (a) Assume that the worst-case running time of F1(N) is O(N), the worst-case running time of F2(N) is O(N), the worst-case running time F3(N) is O(N), the worst-case running time of F4(N) is O(N), the worst-case running time of F5(N) is O(N), and the worst-case running time of F6(N) is O(N). (b) Assume that the worst-case running time of F1(N) is O(N2), the worst-case running time of F2(N) is O(N4), the worst-case running time F3(N) is O5(N6), the worst-case running time of F4(N) is O7(N7), the worst-case running time of F5(N) is O(N5), and the worst-case running time of F6(N) is O(N3). (c) Assume that the worst-case running time of F1(N) is (N2), the worst-case running time of F2(N) is (N4), the worst-case running time F3(N) is (N6), the worst-case running time of F4(N) is (N7), the worst-case running time of F5(N) is (N5), and the worst-case running time of F6(N) is (N3). (d) Assume that the worst-case running time of F1(N) is (N2), the worst-case running time of F2(N) is (N4), the worst-case running time F3(N) is (N6), the worst-case running time of F4(N) is (N7), the worst-case running time of F5(N) is (N5), and the worst-case running time of F6(N) is (N3). (e) Assume that the worst-case running time of F1(N) is (N5), the worst-case running time of F2(N) is (N3), the worst-case running time F3(N) is (N6), the worst-case running time of F4(N) is (N2), the worst-case running time of F5(N) is (N8), and the worst-case running time of F6(N) is (N9)

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

Prepare an electronic rsum.

Answered: 1 week ago