static double count(final Tree<?, ?> program, final int maxNodes) {
		if (maxNodes < 1) {
			throw new IllegalArgumentException(
				"Max node count must be greater than zero: " + maxNodes
			);
		}

		final double cc = min(program.size() - 1, maxNodes);
		return 1.0 - sqrt(1.0 - (cc*cc)/(maxNodes*maxNodes));
	}
This method uses the node count of a program tree for calculating its
complexity. The returned node count <em>measure</em> is within the range
of {@code [0, 1]}. If the program contains only one node, zero is returned.
If the node count is bigger or equal {@code maxNodes}, one is returned.
<p>
The complexity is calculated in the following way:
{@snippet lang="java":
final double cc = min(program.size() - 1, maxNodes);
return 1.0 - sqrt(1.0 - (cc*cc)/(maxNodes*maxNodes));
}

@see #ofNodeCount(int)

@param program the program used for the complexity measure
@param maxNodes the maximal expected node count
@return the complexity measure of the given {@code program}
@throws NullPointerException if the given {@code program} is {@code null}
@throws IllegalArgumentException if {@code maxNodes} is smaller than one
jenetics.prog/src/main/java/io/jenetics/prog/regression/Complexity.java