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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

seq item S.max item( ) returns the item with maximal key (nil if S is<br />

empty).<br />

seq item S.succ(seq item it) returns the successor item of it in the sequence containing<br />

it (nil if there is no such item).<br />

seq item S.pred(seq item x) returns the predecessor item of it in the sequence<br />

containing it (nil if there is no such item).<br />

seq item S.insert(const K& k, const I& i)<br />

seq item S.insert at(seq item it, const K& k, const I& i)<br />

associates information i with key k: If there is an<br />

item 〈k, j〉 in S then j is replaced by i, else a new<br />

item 〈k, i〉 is added to S. In both cases the item is<br />

returned.<br />

Like IT.insert(k, i) where IT is the sequence containing<br />

item it.<br />

Precondition: it is an item in IT with<br />

key(it) is maximal with key(it) < k or<br />

key(it) is minimal with key(it) > k or<br />

if key(it) = k then inf (it) is replaced by i. S and<br />

IT have the same type.<br />

seq item<br />

S.insert at(seq item it, const K& k, const I& i, int dir)<br />

Like IT.insert(k, i) where IT is the sequence containing<br />

item it.<br />

Precondition: it is an item in IT with<br />

key(it) is maximal with key(it) < k if dir =<br />

leda :: before or<br />

key(it) is minimal with k < key(it) if dir =<br />

leda :: behind or<br />

if key(it) = k then inf (it) is replaced by i. S and<br />

IT have the same type.<br />

int S.size( ) returns the size of S.<br />

bool S.empty( ) returns true if S is empty, false otherwise.<br />

void S.clear( ) makes S the empty sorted sequence.<br />

void S.reverse items(seq item a, seq item b)<br />

void S.flip items(seq item a, seq item b)<br />

the subsequence of IT from a to b is reversed, where<br />

IT is the sequence containing a and b.<br />

Precondition: a appears before b in IT .<br />

equivalent to S.reverse items(a, b).

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

Saved successfully!

Ooh no, something went wrong!