Tutorial by Examples

The partition of an integer is a way of writing it as a sum of positive integers. For example, the partitions of the number 5 are: 5 4 + 1 3 + 2 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 Notice that changing the order of the summands will not create a different partition. The partition f...
public class IntegerPartition { public static int[,] Result = new int[100,100]; private static int Partition(int targetNumber, int largestNumber) { for (int i = 1; i <= targetNumber; i++) { for (int j = 1; j <= largestNumber; j++) ...

Page 1 of 1