Posts Tagged ‘pascal’

Using a List instead of an array

Java 8.3.2012 2 Comments

Lists and arrays can both be used to store ordered collections of data. Both have their strengths and weakness which we shall discuss in a later post. Previously we showed you how to generate Pascals Triangle and in that Java example we used arrays to represent each row of the triangle. The following code shows…

Read More

Pascals Triangle

Java 13.2.2011 14 Comments

Write a Java application that prints the first 10 lines of Pascals Triangle. Each row of a Pascals Triangle can be calculated from the previous row so the core of the solution is a method that calculates a row based on the previous row which is passed as input. Once we have that it is…

Read More