Class ModularPascalsTriangle

• java.lang.Object
• ModularPascalsTriangle

• ```public class ModularPascalsTriangle
extends java.lang.Object```
Generate Pascal's Triangle using modular arithmetic given rows and columns of data and modulus.
• Constructor Summary

Constructors
Constructor and Description
```ModularPascalsTriangle(int rows, int cols, int mod)```
Generate Pascal's Triangle using modular arithmetic given rows and columns of data and modulus.
• Method Summary

All Methods
Modifier and Type Method and Description
`int` `getCols()`
Return the number of columns of computed modular Pascal's triangle data.
`int` `getMod()`
Return the modulus value used to compute the modular Pascal's triangle data.
`int` `getRows()`
Return the number of rows of computed modular Pascal's triangle data.
`int` ```getValue(int row, int col)```
Get the modular Pascal's triangle data at the given row and column.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• ModularPascalsTriangle

```public ModularPascalsTriangle(int rows,
int cols,
int mod)```
Generate Pascal's Triangle using modular arithmetic given rows and columns of data and modulus. Column 0 will always contain 1 for all rows. The rest of row 0 will contain zeros. Each non-zero row i and non-zero column j, is the modular sum of values at [row][column] indices [i-1][j-1] and [i-1][j]. Example: If the modulus is 10, and the values at [6][1] and [6][2] are 6 and 5, respectively, then the value at [7][2] is (6 + 5) mod 10 = 1.
Parameters:
`rows` - - number of rows
`cols` - - number of columns
`mod` - - given modulus for arithmetic
• Method Detail

• getValue

```public int getValue(int row,
int col)```
Get the modular Pascal's triangle data at the given row and column. These values should be computed once in the constructor and are not recomputed here.
Parameters:
`row` - - given row index
`col` - - given column index
Returns:
modular Pascal's triangle data at [row][col]
• getRows

`public int getRows()`
Return the number of rows of computed modular Pascal's triangle data.
Returns:
the number of rows of computed modular Pascal's triangle data
• getCols

`public int getCols()`
Return the number of columns of computed modular Pascal's triangle data.
Returns:
the number of columns of computed modular Pascal's triangle data
• getMod

`public int getMod()`
Return the modulus value used to compute the modular Pascal's triangle data.
Returns:
the modulus value used to compute the modular Pascal's triangle data