Pascal's triangle, illustrated on page 419 in the text, has rows that begin and end with 1.
Question:
Pascal's triangle, illustrated on page 419 in the text, has rows that begin and end with "1". Within that, the numbers in each row are the pairwise sums of the numbers in the row above. Consider the following recursive algorithm intended to return row n of Pascal's triangle, if the row at the top is designated to be the 0 row.
Triangle(n)
a. What is the base case? Does the algorithm return correctly in the base case? b. Does the algorithm terminate on non-negative integer input? If so, why? If not, give an example of input on which it fails to terminate. c. If the recursive call returns correctly, does the algorithm return the correct output?
d. Does the algorithm perform correctly? If so, why? If not, why not?
Probability and Statistics
ISBN: 978-0321500465
4th edition
Authors: Morris H. DeGroot, Mark J. Schervish