| | | | | |

Unimodal Set API Semantics

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

| | Top of Page | 9. Introduction to Sets - 6 of 20