Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

TREES

FORSOLUTIONSSCROLLDOWN

1.TheorderofBTreeisdefinedasthe

a.Minimumno.ofkeysinanonrootnode

b.Maximumno.ofkeysinanonrootnode
c.(n+1)/2

d.maxno.ofpointersinanynode

2.Thedepthofacompletebinarytreewith'n'nodesis(logistothebasetwo)
a.log(n+1)-1
b.logn

c.log(n-1)+1
d.log(n)+1

3.Preorderissameas
a.DFS
b.BFS

c.topologicalorder
d.linearorder

4.Whichofthetraversaltechniquelistsnodesofbinarysearchtreeinascendingorder?
a.postorder
b.inorder

c.preorder
d.none

5.Thenumberofpossiblebinarysearchtreesin3nodesis
a.12
b.13
c.5

d.15

6.Binarytreehasnleafnodes.themaxno.ofnodesofdegree2inthistreeis
a.logn(base2)
b.n-1
c.n

d.2^n

7.eachnonrootnodeinaBtreeoforderncontainsatleast
a.(n+1)/2keys

b.n(n+1)/2keys
c.(n-1)/2

d.n(n-1)/2

8.completebinarytreeoflevel5hashowmanynodes?
a.15
b.25
c.63

d.33
9

10.

11.

12,13,14.

15.

16.

17.

18.

19.Inabinarytreewithnnodes,everynodehasanoddnumberofdescendants.

Everynodeisconsideredtobeinitsowndescendant.Whatistheno.ofnodesinthetree

thathaveexactlyonechild?
GATE2010
a.0

b.1

c.(n-1)/2
d.n-1

20.WhatisthemaxheightofanyAVLtreewith7nodes?Assumethattheheightofa

treewithsinglenodeis0.

GATE2009
a.2
b.3

c.4

d.5

21.ConsiderthefollowingCprogramsegmentwherecellnoderepresentsanodeina

binarytree

structCellNode{

structCellNode*leftchild;

22.Abinarytreeinwhichallitslevelexceptpossiblythelast,havemaxno.ofnodes&

allthenodesatthelastlevelappearasfarasleftaspossible,iscalled
a.Fullbinarytree
b.2-tree

c.Threadedtree
d.CompleteBinarytree

23.Thetimerequirestosearchanelementinabinarysearchtreehavingnelemntsis

a.O(1)

b.O(logn)
c.O(n)

d.O(nlogn)

24.Afullbinarytreewithnleavescpntains
a.nnodes

b.lognnodes
c.2n-1
d.2^n\

25.Afullbinarytreewithnnonleafnodescontains

a.lognnodes
b.n+1nodes
c.2nnodes

d.2n+1nodes

26.Inacompletebinarytreeofnnodes,howfararethemostdistant2nodes?Assume
thateachedgeinthepathcountsas1.Assumelognaslogbase2.

a.logn

b.2logn

c.3logn

4.4logn

27.Thenumberofbinarytreeswith3nodeswhichwhentraversedinpostordergivesthe

sequnceA,B,Cis
a.3

b.9
c.5

d.7

28,29

30,31

32,33

34

35

You might also like