in reply to Re: Re: Pascal triange...
in thread Pascal's triangle...
1 3 3 1
1 3 3 1
------------- +
1 4 6 4 1
But if you look carefully, you see that to each element, we add the
element to the left of it, except for the two elements on the far
ends - which will both be one (a "new" 1 on the right, and the one
of the left remains "as is").
And that's how the program works. We first add a new element (with the push), then for each element, we add the preceding one. We have to work backwards of course, which is achieved by the reverse.
Abigail
|
|---|