Queue

From Wiki :-)
Revision as of 04:35, 3 October 2020 by Savoundg (talk | contribs)
Jump to navigation Jump to search

Queue is a data structure that uses a FIFO (first-in first-out) upon which the following operations are supported:

  • queue(object): add object on the end of the queue O(1)
  • pop(): remove the object which on the top of the stack O(1)
  • peek(): return object which is on the top of the stack O(1)

A queue can be used to implement BFS.