1.

Which of the following is correct about the map and unordered map?(a) Ordering of keys in maps whereas no such order in the unordered map(b) Maps are implemented red-black trees whereas unordered map are implemented using hash tables(c) Average search time in the unordered map is O(1) whereas it is O(logn) in case of maps(d) All of the mentionedThis question was posed to me in a national level competition.The query is from More Containers in portion Class Hierarchies, Library & Containers of C++

Answer»

The CORRECT choice is (d) All of the mentioned

Explanation: All the above mentioned POINTS are correct about maps and unordered maps. Maps USES red-black tree WHEREAS unordered map uses hash tables THEREFORE the average search time for the unordered map is O(1) whereas it is O(logn) in case of maps.



Discussion

No Comment Found

Related InterviewSolutions