Dynamic Integer SetsThe data type d_int_set can be used to store a set of ints. Dynamic Integer Sets are an extension of Integer Sets.ExampleThe following program shows how to use Dynamic Integer Sets. It generates ad_int_set DIS and inserts 100 ints into DIS . Then it searches
for entries 37 and 168 in IS .
#include <LEDA/core/d_int_set.h> int main() { leda::d_int_set DIS; DIS.insert(1); DIS.insert(200); int i; for (i=2; i<=99; i++) DIS.insert(2*i); if (DIS.member(37)) std::cout << "37 is stored in S\n"; else std::cout << "37 is not an element of S\n"; if (DIS.member(168)) std::cout << "168 is stored in S\n"; else std::cout << "168 is not an element of S\n"; return 0; } Strengths
Disadvantages
Tips
|
See also: |