Unimodal Set API Semantics
- Unimodal: No element may appear more than once in the set
- Insert(e):
- If e is in the set, Insert(e) overwrites stored element with e
size remains the same
- If e is not in set, Insert(e) inserts e in set
size increased by 1
- Retrieve(e&):
- If e is in the set, e refers to that element
returns true
- else
returns false
- Remove(e):
- If e is in the set, Remove(e) removes e set
size decreased by 1
returns true
- If e is not in set, Remove(e) does not modify set
size is unchanged
returns false
- Iterator i = Includes(e):
- i points to e if e is in set
- i == End() if e is not in set
- Size() returns the number of elements in the set
|