Partitions 

Partitions of a SetA partition of a set, S,
is a collection of disjoint sets,
Kruskal's minimum spanning tree algorithm uses a partition of the vertices of a graph during its intermediate stages to represent a spanningforest of the graph. Partitions of an IntegerA partition of an integer, n, is a set of positive integers, n_{1}, ..., n_{m} that add up to n. (The partitions of an integer n are related to the partitions of a set of size n.) The partitions of n can be enumerated by a simple recursive routine: function partition(n, limit, answer) { var i; if(n > 0) for(i = min(n, limit); i > 0; i ) partition(ni, i, answer now including i); else process the answer }//partition //initial call: partition(n, n, initial empty answer);The exact form of the "answer" depends on what you want to do with a partition, but it represents it in some way, e.g. as an array of integers. The extra parameter, "limit", ensures that each partition is in nonincreasing order, The HTML FORM below allows partitions of small integers to be calculated (press the `go' button): © L. A.


↑ © L. Allison, www.allisons.org/ll/ (or as otherwise indicated). Created with "vi (Linux)", charset=iso88591, fetched Tuesday, 25Jan2022 05:25:37 EST. Free: Linux, Ubuntu operatingsys, OpenOffice officesuite, The GIMP ~photoshop, Firefox webbrowser, FlashBlock flash on/off. 