CSE390D Notes for Friday, 10/25/24

structural induction The set of extended binary trees can be defined recursively by these steps: basis step: The empty set is an extended binary tree recursive step: If T1 and T2 are disjoint extended binary trees, there is an extended binary tree denoted by T1 * T2 consisting of a root r together with edges connecting the root to each of the roots of the left subtree T1 and the right subtree T2 when these trees are nonempty functions on trees: N(T) = # of nodes in a tree N(empty) = 0 N(T1 * T2) = 1 + N(T1) + N(T2) Ht(T) = height of a tree Ht(empty) = 0 Ht(T1 * T2) = 1 + max(Ht(T1), Ht(T2)) The set of fully balanced binary trees (FBBT) can be defined recursively by these steps: basis step: The empty set is a FBBT recursive step: If T1 and T2 are FBBTs with Ht(T1) = Ht(T2), then T1 * T2 is a FBBT The set of Almost Balanced Binary Trees (ABBT) can be defined recursively by these steps: basis step: The empty set is a FBBT recursive step: If T1 and T2 are ABBTs with Ht(T1) = Ht(T2), then ht(T1) - 1 <= ht(T2) <= ht(T1) + 1 then T1 * T2 is a ABBT when T1 in ABBT sample tree: have to move node at RLLRL to something like RLRR or RRRRL structural induction: 1) base case: Show P holds for all basis elements 2) recursive case: Show that if P holds for elements used to construct a new element of S, then P holds for the new element ---------------------------------------------------------------------- If T is a FBBT, then N(T) = 2^Ht(T) - 1 basis step: Ht(empty) = 0, N(empty) = 0 = 2^0 - 1 recursive step: given an FBBT T with subtrees T1 and T2 Ht(T1) = Ht(T2) (by definition) N(T) = 1 + N(T1) + N(T2) applying the inductive hypothesis = 1 + 2^Ht(T1) - 1 + 2^Ht(T2) - 1 = 2^Ht(T) - 1 ---------------------------------------------------------------------- Prove P(T): N(T) >= phi^Ht(T) - 1 for ABBT Base case: Prove P(empty): N(empty) = 0 >= 1 - 1 = phi^0 - 1 Prove P(T) holds when it holds of the components of T: Let T = T1 * T2 without loss of generality, assume Ht(T1) >= Ht(T2) let k = Ht(T1) then Ht(T) = k + 1 Ht(t2) = k or k-1 by i.h., N(T1) >= phi^k - 1 if Ht(t2) = k, then by i.h., N(T2) >= phi^k - 1 if Ht(t2) = k - 1, then by i.h., N(T2) >= phi^(k-1) - 1 phi^k - 1 >= phi^(k-1) - 1 therefore N(T2) >= phi^(k-1) - 1 Need to prove that N(T) >= phi^(k+1) - 1 N(T) = 1 + N(T1) + N(T2) using results from i.h. above: >= 1 + phi^k - 1 + phi^(k-1) - 1 = phi^k + phi^(k-1) - 1 = phi^(k-1)(phi + 1) - 1 = phi^(k-1)(phi^2) - 1 (because phi + 1 = phi^2) = phi^(k+1) - 1
Stuart Reges
Last modified: Fri Oct 25 15:39:40 PDT 2024