/* SsetLib.h */ /* Implements the set library with no dynamic allocation */ /* last modified 29 March 2004 */ #define WORDSIZE 32 #define U 3300 #define WORDS U/WORDSIZE+1 #define true 1 #define false 0 typedef unsigned int set[WORDS]; typedef set setlist[U]; /* ******** Initialization ******** */ extern void SetEmpty (set S); //post: S = {} /* ********* Input/Output ********* */ extern void SetToScreen (set S); //post: elements of S are printed to screen /* ************ Tests ************* */ extern int MemberOfSet (int u, set S); //post: returns 1 if u in S, else returns 0 extern int SetOrder (set S); //post: returns the number of elements in S extern int IntersectTest(set S, set T); //post: returns 1 if S intersect T is not empty, // else returns 0 /* ********** Operations ********** */ extern void SetInsert (int u, set S); //post: u in S extern void SetDelete (int u, set S); //post: u not in S extern void SetUnion (set S, set T, set A); //post: A contains the union of S and T extern void SetIntersection (set S, set T, set A); //post: A contains the intersection of S and T extern void GetSet(set S, set T); //post: S contains only the elements of T