队列
字数: 0

队列

  • A queue means to line up for something.
  • Queues use the First In First Out (FIFO) system. Rather than piling items up, the longest one in the queue will be popped.
    • Insertions are made at the rear of the queue.
      • notion image
    • Deletions take place at the front of the queue.
      • notion image
      • So the last one added is always the last one available for deletion
  • Let 𝒏 be the number of elements in the queue
    • The space used is 𝑶(𝒏)
    • Each operation runs in time 𝑶(𝟏)

双端队列

Deque, a double ended queue
  • You can insert items at either end and delete them at either end
  • There is no longer a front and rear, simply a front and rear, simply 2 ends.
notion image
 
 
2023 - 2026