

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


a 0 = a 1 = a 2 = 1 and an = anโ 1 + anโ 2 + anโ 3 for n โฅ 3 Give a 4 = 5 a 5 = 9
Fact(N) { If N=1 return 1 Else return N*Fact(N-1) }
Fact(3) --> 6 { If 3=0 return 1 / Else return 3Fact(2) <-- } | / Fact(2) <--------- / 2 { If 2=0 return 1 / Else return 2Fact(1) <-- } | | 1 Fact(1) <--------- | { If 1=0 return 1 --------- Else return 1Fact(0) <---- } | | 1 Fact(0) <--------- | { If 0=0 return 1 --------- Else return 0Fact(-1) }
Extended binary tree is defined recursively as follows:
extended binary tree, denoted by T 1 .T 2 , consisting of a root r together with edges connecting the root to each of the roots of the left subtree T 1 and the right subtree T 2 when these trees are nonempty.
Generate the following extended binary tree using the above recursive definition.
0 A / / 0 B
Basis Step: โ Step 1 (Recursive Step): Tree with node B (root node B and two โ left and right subtrees). Step 2 (Recursive Step): Create tree with root node A and left child is the subtree with root B and the right child is the subtree โ .
0 A / / 0 B
Show why the tree created in part (a) cannot be created by the definition of Full Binary Trees.
Right child of A is a subtree which is โ . But โ is not defined as a Full Binary Tree.