31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

d int set S − const d int set& T returns the difference S.diff (T ).<br />

d int set S & const d int set& T returns the intersection of S and T .<br />

d int set S | const d int set& T returns the union S.join(T ).<br />

d int set S % const d int set& T returns the symmetric difference S.symdiff (T ).<br />

d int set& S += const d int set& T assigns S.join(T ) to S and returns S.<br />

d int set& S −= const d int set& T assigns S.diff (T ) to S and returns S.<br />

d int set& S &= const d int set& T assigns S.intersect(T ) to S and returns S.<br />

d int set& S |= const d int set& T assigns S.join(T ) to S and returns S.<br />

d int set& S % = const d int set& T<br />

assigns S.symdiff (T ) to S and returns S.<br />

bool S != const d int set& T returns true if S ≠ T , false otherwise.<br />

bool S == const d int set& T returns true if S = T , false otherwise.<br />

bool S ≥ const d int set& T returns true if T ⊆ S, false otherwise.<br />

bool S ≤ const d int set& T returns true if S ⊆ T , false otherwise.<br />

bool S < const d int set& T returns true if S ⊂ T , false otherwise.<br />

bool S > const d int set& T returns true if T ⊂ S, false otherwise.<br />

void S.get element list(list& L)<br />

Iteration<br />

fills L with all elements stored in the set in increasing<br />

order.<br />

forall elements(x,S) { “the elements of S are successively assigned to x” }<br />

4. Implementation<br />

Dynamic integer sets are implemented by (dynamic) bit vectors. Operations member,<br />

empty, size, min and max take constant time. <strong>The</strong> operations clear, intersection, union<br />

and complement take time O(b−a+1), where a = max( ) and b = min( ). <strong>The</strong> operations

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!