stacks and queues program easier to understand and less error prone (as carpenters will tell youit' safer to use the right tool for the job efficiency of stacks items can be both pushed and popped from the stack implemented in the stackx class in constant ( time that isthe time is not dependent on how many items are in the stack and is therefore very quick no comparisons or moves are necessary queues the word queue is british for line (the kind you wait inin britainto "queue upmeans to get in line in computer science queue is data structure that is somewhat like stackexcept that in queue the first item inserted is the first to be removed (first-in-first-outfifo)while in stackas we've seenthe last item inserted is the first to be removed (lifoa queue works like the line at the moviesthe first person to join the rear of the line is the first person to reach the front of the line and buy ticket the last person to line up is the last person to buy ticket (or--if the show is sold out--to fail to buy ticketfigure shows how such queue looks people join the queue at the rear people leave the queue at the front figure queue of people queues are used as programmer' tool as stacks are we'll see an example where queue helps search graph in they're also used to model real-world situations such as people waiting in line at bankairplanes waiting to take offor data packets waiting to be transmitted over the internet there are various queues quietly doing their job in your computer' (or the network'soperating system there' printer queue where print jobs wait for the