Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let B be the set of all binary trees. Let 2 B denote the empty tree with no vert

ID: 3549950 • Letter: L

Question

Let B be the set of all binary trees. Let 2 B denote the empty tree with

no vertices or edges. For any non-empty tree we write T = hL; Ri 2 B where

L; R 2 B represent the left and right subtrees of the tree T respectively.

Now consider the following recursively dened function:

Prove using induction that for all T 2 B, f(T) is the number of leaves

in T.

Let B be the set of all binary trees. Let 2 B denote the empty tree with no vertices or edges. For any non-empty tree we write T = hL; Ri 2 B where L; R 2 B represent the left and right subtrees of the tree T respectively. Now consider the following recursively dened function:

Explanation / Answer

1) Case 1 only 1 node

   then tree is only that node i.e 1


Case 2

if height of tree is 1

then tree = 1+left(tree) + right(tree)


case N

if height of tree is N-1


then tree = 1+lefttree(N-1) +righttree(N-1)

therefore Since at all levels this condition holds true


SO as a whole we say that tree originated from root node and can be completely represented as 1+lefttree+right tree;


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote