Home > other >  Understanding left hand notation of C(n,2)= n(n−1)​ / 2
Understanding left hand notation of C(n,2)= n(n−1)​ / 2

Time:12-14

For an array of n integers, there are C(n,2)= n(n−1)​ / 2 pairs of integers. Thus, we may check all n(n−1)​ / 2 pairs and see if there is any pair with duplicates.

I was poking around a LeetCode question and the answer for one of the algorithms included the above formula in the question explanation.

What is the point of the C(n, 2) nomenclature on the left hand side of the equation? Is this a known/named standard that I can read and interpret, or is this some more general information that must/should be ascertained from context? I understand the math on the right, but I don't have any preconceived notions that adds any detail to my understanding from the function on the left.

What is the 2 doing?

CodePudding user response:

It's called enter image description here

Here n is the size of the set, and k = 2 is the number of elements to select, so that e.g. sets {3, 6} and {6,3} taken are considered equal.

AFAIK, the standard notation in combinatorics is as shown above and spelled "n choose k", where as C(...) is non-standard requiring clarification when first introduced.

  • Related