Overview
I’m in a strange place here. I’ve written an algorithm, and am now not certain how to document it. I’m looking for assistance in turning this logic into a precise description.
Details
I have a method that takes a variable number of groups as input and spits out a large set of results. The number of results varies with the distribution of items in the groups and the number of groups. I can calculate the number of results that will be created as such:
In Psudocode:
(# of groups -1) * (# items in group 1) * (# items in group 2) * ... * (# items in group n)
In English:
The number of groups minus one, times the number of items in group 1, times the number of items in group 2, times the number of items in group 3 … etc.
Question
Both the pseudocode and English descriptions above seem unwieldy.
How do I more succinctly describe this algorithm? Is there a compact mathematical formula? Or can it be described with more precise words? Better Pseudocode? Any advice would be greatly appreciated.
Here’s my go:
(n-1) * (product of cardinality across sets 1..n) where n = # of groups