Question
Problem 6: Draw all of the full and balanced binary trees formed by 0, 1, 2, and 3 applications of the recursive step of the
Problem 6: Draw all of the full and balanced binary trees formed by 0, 1, 2, and 3 applications of the recursive step of the recursive definition above.
We define the height h(T) of a full binary tree T recursively.
Basis Step: The height of the full binary tree T consisting of only a root r is h(T) = 0.
Recursive Step: If T1 and T2 are full binary trees, then the full binary tree T=T1 * T2 has height h(T) = 1 + max (h(T1), h(T2))
If we let n(T) denote the number of vertices in a full binary tree, we observe that n(T) satisfies the following recursive formula:
Basis Step: The number of vertices n(T) of the full binary tree T consisting of only a root r is n(T)=1.
Recursive Step: If T1 * T2 are full binary trees, then the number of vertices of the full binary tree T = T1 * T2 is n(T) = 1 + n(T1) + n(T1)
PLEASE READ THESE INSTRUCTIONS BEFORE YOU START THE PROBLEMS BELOW In the proofs to follow, you may use the recursive definitions above, as well a s the recursive definitions for h(T) and n(T) given in the textbook, and your definitions for I(T) and () in Problems 1 MUST DO NOT use the properties proved in the problems below in the proofs of other problems. YOU DO EACH PROOF EROM SCRATCH using the recursive definitions for complete binary tree, balanced binary tree, h(T), n(T), I(T) and i(t). Hint: the set of complete binary trees is a subset of the set of full binary trees. Problem 1: (5 points) Formulate a recursive definition for ICT), the number of leaves in a full binary tree T A leaf is a vertex that has no children. Problem 2: (5 points) Formulate a recursive definition for i(T), the number of internal vertices in a full Problent 3: (5 points) Draw the complete binary trees formed by 0, 1 and 2 applications of the recursive step Problem 4: (10 points) Draw the balanced binary trees formed by 0, 1 and 2 applications of the recursive binary tree T. An internal vertex is a vertex that has children. of the recursive definition above. tep of the recursive definition above. For the 2ad application, draw 10 trees.(You don't have to draw t complete set of trees generated by the 2d application.) Problem5: (5 points) A fulland balanced binary tree is a full binary tree in which every leaf is either at l or I-1 for some positive integer I. Write a recursive definition for the set of full and balanced binary trees. Problem 6: (10 points) Draw ALL, of the full and balanced binary trees formed by 0, 1, 2, and 3 applications Problem Z: (10 polnts) Use structural induction to prove that the number of leaves,I(CT), in a complete binary Problem 83 1o points) Use structural induction to prove that the height, hCT), of a complete binary tree T of the recursive step of the recursive definition above. with I(T) leaves is h(T)-log2 I(T). Problem 9: (10 points) Use structural induction to prove that the number of internal vertices, iCT), of a full binary tree Tof height h(T) is i(T) S 2h()-1 Problem 10: (10 points) Use structural induction to prove that the number of internal vertices, i(T), of a complete binary tree T of height h(T) is i(T) 2hCT) - 1. Problem 11: (10 points) Note: please give CLOSED formulas (similar to the formulas given in Problen through Problem 10 above). Do not give recursive formulas for this exercise (Part 1) Deduce a formula for n(T), the total number of vertices of a complete binary tree T, as a functi of height h(T). (Part 2) Deduce a formula for n(T), the total number of vertices of a complete binary tree T, as a functi of the number of internal vertices, i(T). (Part 3) Deduce a formula for n(T), the total number of vertices of a complete binary tree T, as a funct the number of leaves, I(T) oblem 12: (10 points) Use structural induction to prove that the formula you deduced in Problem 11, formula 1 above for n(T) as a function of h(T) is correctStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started