Associative Array


  • key-data pair
    1.類似於字典
    2.key可以為string、number或任何object

  • Implementation of Associative Array in STL
    STL內有兩種資料結構用來實作Associative Array
    1.<map>
    key對應到data(key有排序)
    implementation base on tree
    search的複雜度:O(logn)
    2.<unordered_map>
    key沒有排
    implementation base on hash
    search的複雜度:O(1)

    -->兩者差別重要

results matching ""

    No results matching ""