Q:

Give an example of when each of list, vector, deque, map, and set might be most useful

0

Give an example of when each of list, vector, deque, map, and set might be most useful.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

A `list` may be used when we need to insert/delete at the middle frequently, such as a linked list.

A `vector` may be used when we need random-access, such as a dynamic normal array.

A `deque` may be used like a queue.

A `map` may be used like a dictionary.

A `set` may be used to check whether a value is present.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now