MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/map/map.cpp:11–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10using namespace std;
11signed main(){
12 map<int, string> mp;
13 mp={{1,"a"},{2,"b"},{6,"c"},{3,"g"}};
14 mp[8]="jh";
15 // for(auto it:mp)
16 // cout<<it.first<<" "<<it.second<<endl;
17 // mp.erase(8);//O(log (n))
18 auto it=mp.find(6);
19 if(it==mp.end())
20 cout<<"no value"<<endl;
21 else
22 cout<<(*it).first<<" "<<(*it).second<<endl;
23 return 0;
24}
25//if key and value ae string then compl. is ==O(s.size()*log(n))

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected