Lecture 12
Learning objectives
After this class, you should be able to:
- Given certain operations on a deque, implemented as an array of pointer, draw a figure that shows its state at the end of those operations.
- Given certain operations on a deque, implemented as in sec 3.8, draw a figure that shows its state at the end of those operations.
- Write code for member functions of the deque class, where the deque is implemented either as an array of pointers or as given in sec 3.8.
Reading assignment
- Class notes, Section 3.8 (after fig 3.27).
- Sec 4.6.
Exercises and review questions
- Exercises and review questions on current lecture's material
- Consider a deque implemented using an array of pointers. Let the initial size of this array be 5. Draw the state of the deque after the following operations:
push_front(a)
,push_front(b)
,push_back(c)
,push_back(d)
,push_back(e)
,push_back(f)
.- Consider a deque implemented as in the text book. Draw the state of the deque after the following operations:
push_front(a)
,push_front(b)
,push_front(c)
,push_front(d)
,push_front(e)
,push_front(f)
.- Write code or pseudo-code to implement the
push_back
function of a deque implemented using an array of pointers.- Write code or pseudo-code to implement the
push_back
function of a deque implemented as given in the text book.- Questions on next lecture's material
- Write an example code that uses the STL priority queue.
Last modified: 5 Oct 2009.