Give an example of when each of list, vector, deque, map, and set might be most useful
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:11| Question number:2
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:11| Question number:2
total answers (1)
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.