Answer:
(e) unordered_map<string, unordered_set<int>>
The outer unordered_map is a hash table, so to search the course c it would take constant time O(1). and once we have the course and its unordered_set , which is again a hash table so to serach the student s it would take constant time O(1).So total time is O(1), constant.
(f) map<string, set<int>>
The outer map is a binary search tree, so to search the course c it would take logC time and once we have the course and its set, which is a binary tree, to list the ids in sorted order we need to do an inorder traversal of the tree that would take O(S) time.So total time is O(logC+S)
(g) unordered_map<string, unordered_set<int>>
The outer unordered_map is a hash table, so to search the course c it would take constant time O(1). and once we have the course and its onordered_set , which is another hash table, to list the ids in sorted order we need to loop through all elements in the hash table which takes O(S) time and sort them using any sorting algorithms or else construct another container set<int> that takes O(SlogS) time. So total time is O(SlogS).
(h) unordered_map<string, set<int>>
The outer unordered_map is a hash table, so we loop through each course in it and do search for the student s in its set<int>, which is a binary search tree, if found we print the course else not. The search takes logS time for each course, so total time is O(ClogS).