Answered step by step
Verified Expert Solution
Question
1 Approved Answer
25. which of the following is the correct function to find the number of leaves in a binary tree? (Total Points: 1) a. int binaryTreeType::leavesCount(binary
25. which of the following is the correct function to find the number of leaves in a binary tree? (Total Points: 1) a. int binaryTreeType::leavesCount(binary TreeNode p) const { if (p==NULL) return 0 ; else if (p> llink == NULL \& \& p->rlink == NULL ) return 1 ; else return leavesCount(p> llink )+ leavesCount (p>rlink);} b. int binaryTreeType::leavesCount(binaryTreeNode * p) const { if( p>1 link == NULL \& \& c. int binaryTreeType::leavesCount(binaryTreeNode p) const { if (p==NULL) return 0 ; else if(p->llink==NULL \& \& p->rlink==NULL ) return 1; else { leavesCount(p->1link ) leavesCount (p>rlink);} \} d. int binaryTreeType::leavesCount(binaryTreeNode p) const { if (p>1 link == NULL \& \& p>rlink=NULL) return 0 ; else return 1+ leavesCount (p>1 link )+ leavesCount(p> rlink); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started