CSCE 235
Homework
Assignment 11 – Solution
Assigned: April 17, 2009
Due: 12:30 a.m. April 24,
2009
(Homework 5 minutes late will not be
accepted)
1. (10 points) Suppose that twelve teams (seeded 1 through 12) qualify for the playoffs in a local softball league. In the first round of playoffs, the top four teams get a bye—they do not play. In the first round, Series A pits team # 8 against #9; Series B pits team #7 against #10; Series C pits team #6 against 11; and Series D pits team #5 against #12. In the second round, Series E pits team #1 against the winner of Series A; Series F pits team #2 against the winner of Series B; Series G pits team #3 against the winner of Series C; Series H pits team #4 against the winner of Series D. In the third round, the winners of Series E and Series H play each other in Series I; the winners of Series F and Series G play each other in Series J. Finally, the winners of Series I and Series J play in the championship series. Draw a tree which summarizes the playoff structure in this league.
Solution

![]()
2. (10 points) Draw the graphs of all nonisomorphic unlabeled trees with five vertices.
Solution

![]()
3. (15 points) Draw all the eight spanning trees of the following graph:

Solution
There are:

![]()
4. (30 points) Build a binary search tree for the
words Kansas, Texas, Iowa, Oklahoma, Nebraska, Missouri, and Colordo, assuming
that these words are added one at a time to the binary search tree given the
above order. The left child of a node is
alphabetically ahead of the right child.
Show the binary search tree. How
many comparisons are needed to locate or to add each of the following words in
the search tree, starting fresh each
time? (a) California, (b) Florida, (c) Ohio, (d) Missouri, and (e) Wyoming.
Solution

(a) The comparisons needed to add “California”: One at Kansas, one at Iowa, one at Colorado, thus the number of comparisons is 3.
(b) The comparisons needed to add “Florida”: One at Kansas, one at Iowa, one at Colorado, thus the number of comparisons is 3.
(c) The comparisons needed to add “Ohio”: One at Kansas, one at Texas, one at Oklahoma, one at Nebraska, thus the number of comparisons is 4.
(d) The comparisons needed to locate “Missouri”: One at Kansas, one at Texas, one at Oklahoma, one at Nebraska, and finally one at Missouri; thus the number of comparisons is 5.
(e) The comparisons needed to locate “Wyoming”: One at Kansas, and one at Texas, thus the number of comparisons is 2.
![]()
5. (20 points) Given the following tree,

(a) (5 points) Give the list of names using pre-order traversal.
(b) (5 points) Give the list of names using in-order traversal.
(c) (5 points) Give the list of names using post-order traversal.
(d) (5 points) This is an m-ary tree. What is m?
Solution
(a)
pre-order
traversal: Chevrolet, Audi, Honda, Ford,
Hyundai, Toyota, Volkswagon, Volvo, Mercedes
(b)
in-order
traversal: Audi, Chevrolet, Ford, Honda,
Toyota, Hyundai, Volkswagon, Volvo, Mercedes
(c) post-order traversal: Audi, Ford, Toyota, Volkswagon, Volvo, Hyundai, Mercedes, Honda, Chevrolet
(d) m is 3.
![]()
Problems
based on (Rosen 2003, Goodaire and Parmenter 2002).