Professional Documents
Culture Documents
Nguyen Minh Tri ITITIU14098: Homework
Nguyen Minh Tri ITITIU14098: Homework
4/693
a)
b)
c)
d)
e)
f)
g)
h)
6/694
The rooted tree in exercise 4 is not full m-ary tree because we have 2(j,k) or 3(q,r,s) chidrens in a
tree.
10/694
a) The subtree with root a
a
b
d
c
c
c) The subtree with root e
e
22/694
The chain letter can be represented using a 5-ary tree. Because 10000 people send out the letter,
the number of internal vertices is 10000.
Therefore the number of people have seen letter is
n=5.10000+1=50001.
The number of people have receive letter but not send out is 50001-10000=40001 people.
28/694
In m-ary tree we have:
At level 0, we have 1 vertex in tree
At level 1, we have m vertices in tree
At level 2, we have m2 vertices in tree
Therefore,
1+m+m2+ + mh= (mh+1-1)/(m+1)
And leaves in m-ary tree is mh
32/694
Tree can be used to the represent of contents of the book is :
Level 1of tree is chapters
Level 2 of tree is sections
oenology
campanology
phrenology
ichthyology
alchemy
limnology
ornithology
astrology
6/708
Weighings of a balance scale are needed to find a lighter counterfeit coin among four coins is
[log34]=2
Describe:
We use tree to find counterfeit coin. There are 2-ary tree. We have 4 coin 1,2,3,4. First, we compare
1 and 2 with 3 and 4. If 1 and 2 is lighter, it is the counterfeit. On the other hand, the counterfeit is 3
and 4.
20/709
a) a:01, e: 0, t:101, s: 100
0
1
1
e
0
1
t
0
0
1
a
1
0
1
1
n
0
e
t
0
1
1
0
1
1
0
n
22/709
a:001, b:0001, e:1, r:0000, s:0100, t:001, x:01010
a)
b)
c)
d)
4/722
a)
b)
c)
d)
e)
Level of v is 5
Address of the parent of v is 3.4.5.2
The least number of sibling v can have is 3 ( not including it self)
The smallest possible number of vertices in T if v has address is 19 vertices.
the other addresses that must occur is:
1
0
8/723
A preorder traversal visits the vertices of the given ordered rooted tree is d, I, m, n, o, j, e, b, f, g, k,
p, l, h, c, a.
12/723
The order are the vertices of the ordered rooted tree in Exercise 9 visited using an inorder traversal
is: k, e, l, m, b, f, r, n, s, g, a, c, o, h, d, I, p, j, q.
14/723
The order are the vertices of the ordered rooted tree in Exercise 7 visited using a postorder traversal
is: d, I, m, n, o, j, e, b, f, g, k, p, l, h, c, a.
18/723
a) the expression using a binary tree: