Computer Science 245
Spring 2009
Homework 4: Tree Serialization
Due Wednesday, March 4th, 3:30 p.m.
- Assuming a tree is serialized using the ``Print
null trees'' method, draw the tree for each of the following:
ABD///CE/FG////
AB/D//CE///
A/B/CDE////
- Assuming a tree is serialized using the ``Print an extra 0
bit for internal nodes, and an extra 1 bit for leaves'' method,
draw the tree for each of the following:
A0B0C1D1E0F1G1
A0B1C0D0E1F0G1H1I1
- Assuming a general tree is searialzied using the "Print an
end of child marker" method, draw the tree for each of the
following:
ABF))CG))DH)I))E))
ABCD)))EFG))))
ABE)F)G))C)DH)I)J)))
- Write a method Serialize, that takes as input a general
tree and serializes it using the ``Print Child end of child
Marker'' method. Use a ")" for an end-of-child
marker. Skeleton code is avaiable here: