#include #include #include #include //a binary search tree #include //a hash table using namespace std; int main() { //picked key of type string, and value of type double. //key's must be comparable, values can be anything. map monsters; //unordered_map monsters; pair godzilla; godzilla.first = "godzilla"; godzilla.second = 5000; monsters.insert(godzilla); //bracket notation to insert for ease of use monsters["kong"] = 1500; monsters["mothra"] = 1200; monsters["goku"] = 10; monsters["bear"] = 2; //Can lookup value froms key: cout << "motha's power level is " << monsters.at("mothra") << endl; //O(log n) cout << "motha's power level is " << monsters["mothra"] << endl; //O(log n) monsters["goku"] = 4999; monsters["bear"]++; monsters["godzilla"] = 8000; //Can iterate through container items //Run time: O(n) for (auto x : monsters) cout << x.first << " : " << x.second << endl; cout << godzilla.second << endl; return 0; }