/* BigSet package, Copyright (C) 2002, Tim McLarnan This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Do, please, let me hear from you if you use this package, or if you have questions. Tim McLarnan, Dept. of Mathematics, Earlham College, Richmond, IN 47374 USA timm AT cs.earlham.edu */ #include #include /* * BigSets are structs modeling sets of arbitrary size. * The set theoretic operations on BigSets assume that all the sets * we are working with have a common universal set, * {0, 1, 2, ... , universe-1}. * * A BigSet contains a long giving the size of the common universe, * together with an array of chars in which element[k] is 1 or 0 * according as k is or is not a member of the set. */ typedef struct bset { long universe; /* size of the universe */ unsigned char * element; } BigSet; int BigSetDiff(const BigSet a, const BigSet b); void BigSetMakeNull(BigSet *b); int BigSetMake(BigSet *b, long max_size); void BigSetFree(BigSet *b); int BigSetAddElement(BigSet *b, long e); int BigSetRemoveElement(BigSet *b, long e); int BigSetElementOf(BigSet b, long e); void BigSetPrint(BigSet b); int BigSetCopy(BigSet source, BigSet *target); void BigSetPlaceUnion(BigSet a, BigSet b, BigSet *un); void BigSetPlaceIntersection(BigSet a, BigSet b, BigSet *inter);