Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 543 Bytes

Queues.md

File metadata and controls

34 lines (27 loc) · 543 Bytes

Queues are a linear data structure that can only be accessed from the first or earliest element. This is also known as FIFO: First In, First Out.

[][][][][][][]
Dequeue
[][][][][][][] 
[][][][][][]   -> []
[][][][][][]
Enqueue
[]      [][][][][][] 
[] -> [][][][][][][]
      [][][][][][][]
Peek      v
[][][][][][] 
Method [[Big O]]
lookup O(n)
enqueue O(1)
dequeue* O(1)
peek O(1)
* dequeue removes the first element