vendredi 17 avril 2015

C++ How to distinguish Multimap with duplicate keys with value and and Unique keys with values in different map containers with O(n) traversal

Hi I would like to seperate multimap with two seperate Map containers


multimap<string,string> MulMap // Multimap Container

map <string,string> DuplicateKeyValueMap

map <string,string> UniqueKeyValueMap


Upon MulMap Iteration I am able to separate duplicate keys and unique keys using count and equal_range

I googled and got info that this approach takes O(n log n) complexity.


Is there a better way than this to code to achieve O(n) complexity?


Aucun commentaire:

Enregistrer un commentaire