Question
Problem 1.12 (page 42). To be precise, let us define the function p for Pascal which takes two arguments: r -- the row number e
Problem 1.12 (page 42). To be precise, let us define the function p for "Pascal" which takes two arguments:
r -- the row number e -- the element number in the row
So (p r e) is the value of element e in row r. And we number the rows starting from 0, and we also number the elements in each row starting from 0. (That is the usual convention.) Thus for instance,
(p 0 0) evaluates to 1 (p 2 1) evaluates to 2 (p 4 2) evaluates to 6
and so on. The problem then is to write a recursive Scheme procedure for the function p. And I really mean "recursive". For this problem, forget everything you ever learned about formulas for the elements of Pascal's triangle that involve factorials.
And I shouldn't really have to say this, but you should make sure you test your function, and indicate to me how you did this.
the following pattern of numbers is called Pascals triangle.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
the numbers at the edge of the triangle are all 1, and each
number inside the triangle is the sum of the two numbers
above it.35 Write a procedure that computes elements of
Pascals triangle by means of a recursive process.
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