Does peek alter the contents of a queue?


#1

Question

Does the peak operation alter the contents of a queue?

Answer

A peek operation should not alter the contents of the queue. It should only return the value of the item at the head of the queue. The dequeue operation would return the value of the queue head AND remove the item.