|
ADS
Algorithms and Data Structures
|
SET (section 3.2.2): a finite collection of distinct items; union(), intersection() and difference() are functions of two sets. More...
#include <ADS/ADT.h>
SET (section 3.2.2): a finite collection of distinct items; union(), intersection() and difference() are functions of two sets.
As axioms, \( \mathrm{contains}( x , \mathrm{create} ) = \mathbf{false} \), \( \mathrm{contains}( x , \mathrm{insert}( y , A ) ) = ( x = y ) \lor \mathrm{contains}( x , A ) \), \( \mathrm{contains}( x , \mathrm{remove}( y , A ) ) = ( x \neq y ) \land \mathrm{contains}( x , A ) \); inserting an item already there, and removing one that is not, leave the set as it is (a relaxation of the preconditions \( x \notin A \) and \( x \in A \) that some specifications state)