COMPUTATION OF BINOMIAL COEFFICIENTS
Let C[n,k] be array of binomial coefficients
ALGORITHM
1. INITIALIZE C[I,0] AND C[I,I] TO 1 FOR 0 <= I <= N
2. COMPUTE
C[K,I], 2 <= K <= N, 1 <= I <= K-1
FROM
C[K,I] := C[K-1,I-1] + C[K-1,I]
DO 10 I = 0,N
10 C[I,0] := C[I,I] := 1
DO 11 K = 2,N
DO 12 I = 1,K-1
12 C[K,I] := C[K-1,I-1] + C[K-1,I]
11 CONTINUE
Previous slide
Next slide
Back to first slide
View graphic version