Question: In lectures, we considered the set B of binary trees defined recursively by: . Base case: the trivial tree t = . is in B;

In lectures, we considered the set B of binary
In lectures, we considered the set B of binary trees defined recursively by: . Base case: the trivial tree t = . is in B; . Recursive case: if 71, T2 E B then so is the tree T, * T2 given by 12 71 * 12 = We can define recursive functions v : B - N and e : B - N which respectively count the number of vertices and the number of edges of a binary tree. For u we take: . Base case: v(t) = 1; . Recursive case: U(T, * T2) = U(T]) + v(T2) + 1. For e we take: . Base case: e(t) = 0; . Recursive case: e(T, * T2) = e(T,) + e(T2) + 2. (i) [3 marks]. Evaluate the functions e and u at the binary tree T = (t * t) * (t * t). Confirm your answers by drawing the binary tree represented by T; it should have v(T) vertices and e(T) edges. (ii) [4 marks]. Prove by structural induction that, for all binary trees T, we have v(T) = e(T) + 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!