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

A d-ary tree is a rooted tree in which each node has at most dchildren. Show that any d-ary tree with n nodes must have a depth ofฮฉ(lognlogd) .Can you give a precise formula for the minimum depth it could possibly have?

Short Answer

Expert verified

The depth of n node is equal to ฮฉlognlogd. Minimum depth of d-ary tree with n nodes is ฮฉlognlogd.

Step by step solution

01

Find the number of vertices and nodes

A d-ary tree is defined as a d-heap which is a priority queue data structure that contains dnumber of nodes in place of two nodes.

Assume that the difference between left and right subtree is not greater than 1 by height and every node is having d times more node than upper level.

So, number of vertices at level n is

V=dn

And number of nodes at depth is

H=dn

02

Calculate total number of nodes of the tree

Number of nodes at each level are:

Levelโ€‰1=1Levelโ€‰2=dLevelโ€‰3=d2Levelโ€‰4=d3

Number of nodes at level h+1 is dh.

So, it forms a geometric series 1+d+d2+d3+...+dh

First element a by removing 1 from series is d.

Common ratio =d

Sum of the total nodes of the treedh+1-1d-1.

Let number of nodes in a tree is n.

Then,

dh+1=nร—(d-1)+1d(h+1)3=n+1

Taking log on both sides: log(d(h+1)3)=log(n+1)

So, h3lognlogd . It is defined as h3ฮฉlognlogd

So, the depth of n node is equal to ฮฉlognlogd. Minimum depth of d-ary tree with n nodes isฮฉlognlogd .

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

Digital signatures, continued.Consider the signature scheme of Exercise 1.45.

(a) Signing involves decryption, and is therefore risky. Show that if Bob agrees to sign anything he is asked to, Eve can take advantage of this and decrypt any message sent by Alice to Bob.

(b) Suppose that Bob is more careful, and refuses to sign messages if their signatures look suspiciously like text. (We assume that a randomly chosen messageโˆ’that is, a random number in the range{1,...,N-1} is very unlikely to look like text.) Describe a way in which Eve can nevertheless still decrypt messages from Alice to Bob, by getting Bob to sign messages whose signatures look random.

Unlike a decreasing geometric series, the sum of the1,12,13,14,15,..... diverges; that is,โˆ‘i=1n1i=โˆž

It turns out that, for large n , the sum of the first n terms of this series can be well approximated as

โˆ‘i=1n1iโ‰ˆInn+y

where is natural logarithm (log base e=2.718...) and y is a particular constant 0.57721...... Show that

โˆ‘i=1n1i=ฮธ(logn)

(Hint: To show an upper bound, decrease each denominator to the next power of two. For a lower bound, increase each denominator to the next power of 2 .)

Determine necessary and sufficient conditions on xandc so that the following holds: for anya,b, if axโ‰กbxmodc, thenaโ‰กbmodc .

Consider an RSA key set with p = 17 , q = 23, N = 23 and e = 3 (as in Figure 1.9). What value of d should be used for the secret key? What is the encryption of the message M = 41 ?

Quadratic residues. Fix a positive integer N. We say that a is a quadratic residue modulo N ifthere exists a such that aโ‰กx2modN.
(a) Let N be an odd prime and be a non-zero quadratic residue modulo N. Show that there are exactly two values in{0,1,....,N-1} satisfying x2โ‰กamodN.
(b) Show that if N is an odd prime, there are exactly(N+1)2 quadratic residues in {0,1,...,N-1}.
(c) Give an example of positive integers a and N such thatx2โ‰กamodNhas more than two solutions in {0,1,...,N-1}.

See all solutions

Recommended explanations on Computer Science 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