COP3530
DATA STRUCTURES AND ALGORITHMS
Instructor: Manuel Bermúdez
Fall 2009
MIDTERM EXAM
2
Closed Books, Closed Notes, 50 Minutes
Problem 1
_______ (20p.)
Problem 2
_______ (20p.)
Problem 3
_______ (20p.)
Problem 4
_______ (20p.)
Problem 5
_______ (20p.)
SCORE
_______ (100p.)
UFID :
Name :
Note: Turn in your work on this exam only
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Problem 1.
Recall that the degree of a node in a tree is defined as the number of its children, and the
degree of a tree as the maximum degree of its children. Also recall that the height of a
tree is the number of its levels (tree with just one node has height 1), or equivalently the
length of the longest path starting from the root. Now consider a tree which has degree d,
and height h.
(a) What is the maximum number of nodes n this tree can have?
(b) What is the minimum number of nodes n this tree can have?
(c) Assuming this tree has n nodes, what is the minimum possible height (in terms of d
and n) this tree can have?
(d) If a binary tree has n leaves, how many internal nodes (nonleaves) does it have?
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Davis
 Algorithms, Data Structures

Click to edit the document details