"multiset" & "multimap" - What's the point?

Sebastian Dressler picture Sebastian Dressler · May 18, 2010 · Viewed 12.3k times · Source

As the question states ... I don't get the point about multisets / multimaps.

So, what's the purpose?

Answer

extraneon picture extraneon · May 18, 2010

Some use cases:

multimap

  • With ZIP code as a key, all people which have that ZIP code
  • With account ID as key, all open orders of that person/account
  • A dictionary, with per keyword various explanations

multiset

is in essence a map with a key and a integer count.

  • The inventory of a shop, all products have their key and the amount still available is the value
  • accumulated sales data of a shop, every time a product is sold the product id get's added to the multiset thereby increasing the amount sold