| | | | | |

Unimodal Table API Semantics

  • Unimodal: No key may appear more than once in the table
  • Insert(k,d):
    1. If k is in the table, Insert(k,d) overwrites stored data with d
      size remains the same
    2. If k is not in table, Insert(k,d) inserts pair (k,d) in table
      size increased by 1
  • Retrieve(k,&d):
    1. If k is in the table, Retrieve(k,&d) sets d to reference the data stored with k
      returns true
    2. If k is not in table, Retrieve(k,&d) does not modify d
      returns false
  • Remove(k):
    1. If k is in the table, Remove(k) removes pair (k,data) from table
      size decreased by 1
      returns true
    2. If k is not in table, Remove(k) does not modify table
      size is unchanged
      returns false
  • Iterator i = Includes(k):
    1. i points to pair (k,d) if k is in table
    2. i == End() if k is not in table
  • Size() returns the number of (key,data) pairs in the table

| | Top of Page | 10. Introduction to Maps - 3 of 11