If I have a map:
What would the best,average, and worst case time complexity be to find a key, and then iterate through the vector to find a specific int?
I know the map.find() method is O(log n), but does the fact that I have to then search for an int within a vector change the time complexity?
I think doing it will still have the same complexity, but the overall time will be high because of the vector<int>'s equality operator, as it will check all the elements it has got.
Last edited on