push
adds a new nodepop
removes a nodeWhere should the nodes be added/removed for maximum efficiency?
push
adds before first, pop
removes lastpush
adds before first, pop
removes firstpush
adds after last, pop
removes lastpush
adds after last, pop
removes firstpush
adds element to buffer, increments sizepop
returns buffer element, decrements sizeWhere should the elements be added/removed for maximum efficiency?
push
adds before first, pop
removes lastpush
adds before first, pop
removes firstpush
adds after last, pop
removes lastpush
adds after last, pop
removes firstadd
adds a new noderemove
removes a nodeWhere should the nodes be added/removed for maximum efficiency?
add
adds before first, remove
removes lastadd
adds before first, remove
removes firstadd
adds after last, remove
removes lastadd
adds after last, remove
removes firstAssume the buffer has size 10. What is its contents after these operations?
for (i = 1; i <= 8; i++) q.add(i); for (i = 1; i <= 4; i++) q.remove(); for (i = 1; i <= 8; i++) q.add(i); for (i = 1; i <= 4; i++) q.remove();