Queue: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Queue is a data structure that | Queue is a data structure that implements a FIFO (first-in first-out) ordering upon which the following operations are supported: | ||
* | * add(object): add object at the end of the queue O(1) | ||
* | * remove(): remove the object which at the beginning of the stack O(1) | ||
* peek(): return object which is | * peek(): return object which is at the beginning of the stack O(1) | ||
A queue can be used to implement | A queue can be used in BFS or to implement a cache. | ||
Revision as of 04:41, 3 October 2020
Queue is a data structure that implements a FIFO (first-in first-out) ordering upon which the following operations are supported:
- add(object): add object at the end of the queue O(1)
- remove(): remove the object which at the beginning of the stack O(1)
- peek(): return object which is at the beginning of the stack O(1)
A queue can be used in BFS or to implement a cache.