Problem 5: A full and balanced binary tree is a full binary tree in which every leaf is either at level l or l-1 for some positive integer l. Write a recursive definition for the set of full and balanced binary trees.
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 correct