Chapter 15 - Worked Exercises 3
Exercise 1
Define the data structure that is internally used by the std::vector class, the std::list class, and the std::deque class.
Draw a diagram for each of these container classes, illustrating how elements in the container class are stored in memory.
Exercise 2
Complete the table below for the performance of insertion/removal of elements at each position for each container class.
Specify whether the operation is done at constant time, or at linear time, with a small explanation why.
std::vector
std::list
std::deque
Insertion or removal at the front
Insertion or removal at the middle
Insertion or removal at the back
Exercise 3
Complete the Restaurant Queuing System from Worked Exercises 1, which makes use of the std::deque class.
Last updated
Was this helpful?