Built-in Big (O) Hash Card?

If you insert a hash map as follows:

Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>();
Map<String, String> innerMap = new HashMap<String, String>();

innerMap.put("x","y");
map.put("z", innerMap);

innerMap = map.get("z"); <---------- O(1) time
String y = innerMap.get("x"); <-------- O(1) time

Does this mean that as long as the search time for both cards remains relatively close to O (1), you can significantly search for the second level of the hash map back in O (1) time?

In my internship responsibilities I deal with data matching, and the other day I used something similar to this. I had a string key value, which was the name of a specific "Plan" and the value as a hash map. The internal hash file had the key value of the employee identifier and the relationship (if the visitor was visited twice, that is, had in mind two different levels of coverage in the plan from the external map, then their connection would be updated. Was my DS choice good here? I tried to achieve search and edit time O (1)

+4
2

O(1) , " ". , () , . O(1) .

, .. O(1).

"", O(1) .

+4

, - . . . , , , . - ; O (1) * 2 = O (2), O (1). , , . , , .

+2

All Articles