Question: a. Write a recursive method that computes the number of null pointers in a binary tree. public int numberofnullPointers (BinaryNode tree); b. Let n be
a. Write a recursive method that computes the number of null pointers in a binary tree. public int numberofnullPointers (BinaryNode tree); b. Let n be the number of nodes in a binary tree. Prove by induction on n that the number of null pointers in a non-empty binary tree equals n+1. (Hint: What is P(n) ? Do not begin to write a proof until you have defined what P(n) is.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
