HW04
CSE 331
Section 1
Due Friday
8 Feb
noon
1 Feb version
Remember to appropriately justify answers/reasoning. Also remember that this is
individual work.
1)
Problem 4.5 of the text: use mathematical induction to do the proof. Show that the
maximum number of nodes in a binary tree of height
h
is
1
2
)
1
(

+
h
.
2)
Relate this to problem 4.5 of the text.
a)
Compute the average depth of a node in a perfect binary tree of height h and n =
1
2
)
1
(

+
h
nodes (give a formula). (Give an exact answer for
h = 4
.)
b)
What is the average case effort for a successful search in this tree?
c)
What is the worst case effort of a failed search in the tree?
d)
What is the average case effort of a failed search in this tree?
Be more precise than Big Oh: Derive
formulas in terms of
h
and
n
that are simple
and also accurate to within 0.5 of the exact answer. In doing this, assume that the cost of
finding the root key is 1, the cost of finding a key in the root’s children is 2, and the cost
of finding a leaf node is h+1. Also, the cost of not finding a key in a leaf node is h+1.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 M.McCullen
 Algorithms, Data Structures, perfect binary tree, average case effort

Click to edit the document details