liveBook · Manning

Cartesian product

A Cartesian product is the set of all ordered tuples formed by selecting one element from each of multiple sets or sequences.

How 2 Manning books explain it

Fabulous Adventures in Data Structures and Algorithms

A Cartesian product algorithm enumerates tuples by choosing one element from each of multiple input sequences.

How it is used
Generates every pairing or longer tuple of independent choices, including combinations useful for test cases.
How deep it goes
Builds two-input and arbitrary-input implementations, including projection, result types, and zero-input behavior; does not provide performance measurements.
Examples
Uses character-class and weapon pairings, three strings of letters, and products of decimal digits.
What you can do after
Build it from scratch as C# extension methods for fixed or runtime-known input counts, optionally projecting each result.

Read how Fabulous Adventures in Data Structures and Algorithms explains Cartesian product →

Java Persistence with Spring Data and Hibernate epub

A relational operation that forms every possible pairing of rows from two relations, potentially producing redundant combinations when multiple collections are joined.

How it is used
Diagnoses oversized SQL results caused by eager JOIN fetching of multiple collections.
How deep it goes
Explains row multiplication, redundant data, and operational costs, but does not detail database execution optimization.
Examples
Uses an Item with bids and images, showing nine rows for 3 × 3 collections and 250 rows for 50 × 5 collections.
What you can do after
Diagnose redundant joined results and select a procedure-specific fetching strategy instead of eagerly joining multiple collections.

Read how Java Persistence with Spring Data and Hibernate epub explains Cartesian product →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.