JavaScript Algorithms and Data Structures: Sets - Cartesian Product

Cartesian product of two sets is the set of all possible pairs of elements, one from each set. Learn how to calculate the Cartesian product of two sets in JavaScript.

In set theory a Cartesian product is a mathematical operation that returns a set (or product set or simply product) from multiple sets. That is, for sets A and B, the Cartesian product A × B is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B.

Cartesian product AxB of two sets A={x,y,z} and B={1,2,3}

Cartesian Product of Two Sets

References

Wikipedia

The Original Article can be found on https://github.com

#javascript #algorithms #datastructures #sets

JavaScript Algorithms and Data Structures: Sets - Cartesian Product
4.05 GEEK