C Interfaces and Implementations: Techniques for Creating Reusable Software
by David R. Hanson - Princeton University
Chapter 9. Sets
A set is an unordered collection of distinct members. The basic operations on a set are testing for membership, adding members, and removing members. Other operations include set union, intersection, difference, and symmetric difference. Given two sets s and t, the union s + t is a set that contains everything in s and everything in t; the intersection s * t is the set whose members appear in both s and t, the difference s - t is the set whose members appear in s but not in t, and the symmetric difference, often written as s / t, is the set whose members appear in only one of s or t.
Sets are usually described in terms of a universe — the set of all possible members. For example, sets of characters are usually associated with the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access