“多重组” & “多重映射” - 重点是什么? [英] "multiset" & "multimap" - What's the point?

查看:217
本文介绍了“多重组” & “多重映射” - 重点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题所述...我不了解 multiset / multimap

解决方案

有些用例:



p>

multimap




  • 以邮政编码为键,所有拥有该邮政编码的人

  • 以帐户ID为键,该人/帐户的所有打开订单

  • 一个字典,说明
  • 具有键和整数计数的地图。




    • 商店的库存,所有产品都有自己的钥匙和金额
      仍然可用的是

    • 商店的累积销售数据的值。每次销售产品时,将
      产品id get添加到multiset,从而增加销售量


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

    So, what's the purpose?

    解决方案

    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

    这篇关于“多重组” & “多重映射” - 重点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆