Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Solve the following: For each of the following recurrences, give an expression for the running time T(n) if the recurrence can be solved using

1. Solve the following:

For each of the following recurrences, give an expression for the running time T(n) if the recurrence can be solved using the Master Theorem. Otherwise, indicate that the Master theorem does not apply.

a) T(n) = 2T(image text in transcribed) + O(n),

b) T(n) = 9T(n/3) + O(n3),

c) T(n) = 3T(n/9) + 5,

d) T(n) = 5T(n/2) + 2n2,

e) T(n) = 8T(n/2) +O(n3).

f) How many times does the following program print still going? Express your answer as a function of n (in O(.) form).

function f(n)

if n > 1:

for i=0 to n-1:

print_line(still going)

f(n/3)

f(n/3)

Hint: Let T(n) be the number of times that the function f(n) will print "still going". You need to write a recurrence for T(n) and solve it (using any method you like). You may assume n is a power of 3.

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions