“multiset” & “multimap” - What's the point?

后端 未结 7 1657
孤城傲影
孤城傲影 2020-12-08 18:58

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

So, what\'s the purpose?

相关标签:
7条回答
  • 2020-12-08 19:46

    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
    0 讨论(0)
提交回复
热议问题