This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 2 ିଵ ൈ 2 ൌ 2 ିଵାଵ ൌ 2 ሺାଵሻିଵ . So it is shown that if the maximum number of nodes that a binary tree may contain at level ݇ is 2 ିଵ , then the maximum number of nodes at level ݇ 1 is 2 ሺାଵሻିଵ . Since both the basis and the inductive step have been proved, it has now been proved by mathematical induction that the maximum number of nodes that a binary tree may contain at level n is 2 ୬ିଵ . Question 4 (15 Points) class TreeNode //full implementation can be found in slides { … TreeNode *leftChildPtr; TreeNode *rightChildPtr; … }; int numberOfNodes(TreeNode * node) { if (node == NULL) return 0; else return numberOfNodes(node> leftChildPtr) + numberOfNodes(node> rightChildPtr) + 1; }...
View
Full
Document
This note was uploaded on 02/01/2010 for the course CS cs202 at Bilkent University.
 Spring '10
 NoProfessor

Click to edit the document details