CSCE 221: Data Structures and Algorithms

Sections: 507, 508, 509
Fall 2015



Homework 3


Due Date: Sept. 18th (before class)


Assignment

  1. R7.5 (Pg. 310)

    What are the minimum and maximum number of internal and external nodes in an improper binary tree with n nodes?

  2. R7.16 (Pg. 311)

    Answer the following questions so as to justify Proposition 7.10 (Pg. 287).

    1. What is the minimum number of external nodes for a binary tree with height h? Justify your answer.
    2. What is the maximum number of external nodes for a binary tree with height h? Justify your answer.
    3. Let T be a binary tree with height h and n nodes. Show that log(n+ 1) - 1 ≤ h ≤ (n - 1)/2.
    4. For which values of n and h can the above lower and upper bounds on h be attained with equality?

  3. R7.27 (Pg. 312)

    Show how to use the Euler tour traversal to compute the level number, defined in Section 7.3.5 (Pg. 295), of each node in a binary tree T. Specifically, describe in pseudocode each of the visit actions for the traversal.


Bonus

    C7.12 (Pg. 314)

    Two ordered trees T' and T'' are said to be isomorphic if one of the following holds:


    Design an algorithm that tests whether two given ordered trees are isomorphic. What is the running time of your algorithm?


Grading Rubric

Each homework composes 2% of your final grade. Each homework will be graded out of 100 possible points. In any problem asking you to design an algorithm please also provide proper pseudocode (mathematical notation), complexity analysis (both space and time), and brief justification of complexity and correctness.

All assignments must be turned in with a signed coverpage. If no coverpage is provided, the assignment will not be graded.

If there are any discrepancies in grades please see Jory Denny during his office hours (not the TA or Grader).