Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Suppose that the function \(f\) satisfies the recurrence relation \(f(n) = 2f(\sqrt n ) + 1\) whenever \(n\) is a perfect square greater than\(1\)and\(f(2) = 1\).

a) Find\(f(16)\).

b) Give a big- \(O\) estimate for\(f(n)\). (Hint: Make the substitution\(m = \log n\)).

Short Answer

Expert verified

(a)The required function\(f(16) = 7\).

(b)The required function\(f(n) = O(\log n)\).

Step by step solution

01

Given information

The function \(f\) satisfies the recurrence relation\(f(n) = 2f(\sqrt n ) + 1\). Where\(n\)is a perfect square greater than\(1\)and\(f(2) = 1\).

02

Explain the Master theorem

The master theorem is a formula for solving recurrence relations of the form:\({\bf{T}}({\bf{n}}) = {\bf{aT}}({\bf{n}}/{\bf{b}}) + {\bf{f}}({\bf{n}})\), Where, \({\bf{n}} = \) the size of the input \({\bf{a}} = \) number of sub-problems in the recursion \({\rm{n}}/{\rm{b}} = \) size of each subproblem. All subproblems are assumed to have the same size.

03

Calculate the function\(f(16)\)

(a)

To find\(f(16)\):

\(f(16) = 2f(4) + 1\)

\(f(16) = 2(2f(2) + 1) + 1\)

\(\begin{array}{l}f(16) = 2(2 + 1) + 1\\f(16) = 7\end{array}\)

04

Calculate the value of\(f(n)\)by the Master theorem

(b)

Use the suggested substitution and let\(m = \log n\).

So,\({2^m} = n\)

Now, it will may be\(f(n) = f\left( {{2^m}} \right)\).

\(\begin{array}{l}f(n) = 2f\left( {\sqrt {{2^m}} } \right) + 1\\f(n) = 2f\left( {{2^{m/2}}} \right) + 1\end{array}\)

Re-write the function, for clarity, as\(g(m) = f\left( {{2^m}} \right)\).

And so, \(g(m) = 2g(m/2) + 1\).

Next, apply the Master theorem with\(a = 2,\,\,b = 2,\,\,c = 1,\,\,d = 0\):

\(\begin{array}{l}g(m) = O\left( {{m^{{{\log }_2}2}}} \right)\\g(m) = O(m)\end{array}\)

Hence,\(f(n) = O(\log n)\).

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Use generating functions (and a computer algebra package, if available) to find the number of ways to make change for 1 using pennies, nickels, dimes, and quarters with

a) no more than 10 pennies.

b) no more than 10 pennies and no more than 10 nickels.

c) no more than 10 coins

Use generating functions to find the number of ways to choose a dozen bagels from three varietiesโ€”egg, salty, and plainโ€”if at least two bagels of each kind but no more than three salty bagels are chosen.

LetG(x)be the sequence of Catalan numbers, that is, the solution to the recurrence relationwith.

(a)Show that ifis the generating function for the sequence of Catalan numbers, thenxG(x)2-G(x)+1=0. Conclude (using the initial conditions) thatG(x)=(1-1-4x)/(2x).

(b) Use Exercise 40 to conclude that G(x)=โˆ‘n=0โˆž1n+1(2nn)xn,so thatCn=1n+1(2nn).

(c) Show thatCnโฉพ2n-1for all positive integersn.

Find the coefficient of \({x^{10}}\) in the power series of each of these functions.

a) \({\left( {1 + {x^5} + {x^{10}} + {x^{15}} + \cdots } \right)^3}\)

b) \({\left( {{x^3} + {x^4} + {x^5} + {x^6} + {x^7} + \cdots } \right)^3}\)

c) \(\left( {{x^4} + {x^5} + {x^6}} \right)\left( {{x^3} + {x^4} + {x^5} + {x^6} + {x^7}} \right)(1 + x + \left. {{x^2} + {x^3} + {x^4} + \cdots } \right)\)

d) \(\left( {{x^2} + {x^4} + {x^6} + {x^8} + \cdots } \right)\left( {{x^3} + {x^6} + {x^9} + } \right. \cdots \left( {{x^4} + {x^8} + {x^{12}} + \cdots } \right)\)

e) \(\left( {1 + {x^2} + {x^4} + {x^6} + {x^8} + \cdots } \right)\left( {1 + {x^4} + {x^8} + {x^{12}} + } \right. \cdots )\left( {1 + {x^6} + {x^{12}} + {x^{18}} + \cdots } \right)\)

Construct a variation of the algorithm described in Example 12 along with justifications of the steps used by the algorithm to find the smallest distance between two points if the distance between two points is defined to bed((xi,yi),(xj,yj))=max(|xi-xj|,|yi-yj|).

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free