Stacks and Queues
Table 27 – Time and space requirements for stacks and queues
operation
time cost
space cost
Insert at end
C
t + p
Remove (pop)
C
t + p (recovered)
Container overhead
 
(2p+i) + N(t+p)
Comments
Implemented as singly-linked list.
Templatized version allows choice of container: time and space costs will reflect that choice.