キュー

最初に追加された要素が最初に削除されるFIFO構造。

A queue is an abstract data type where elements are added at the back (enqueue) and removed from the front (dequeue). It mimics real-world waiting lines and is vital for asynchronous tasks, printer spooling, and breadth-first search algorithms.

        graph LR
  Center["キュー"]:::main
  Rel_stack["stack"]:::related -.-> Center
  click Rel_stack "/terms/stack"
  Rel_array["array"]:::related -.-> Center
  click Rel_array "/terms/array"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 理解度チェック

1 / 1

🧒 5歳でもわかるように説明

アイスクリームの列に並んでいるところを想像してください。列の最初の人が最初にサービスを受け、新しい人は後ろに並びます。それがキューの仕組みです!

🤓 Expert Deep Dive

ロックフリーキュー(Michael-Scott)は高スループットの並行アクセスを可能にします。リングバッファはキャッシュ効率が良いです。ワークスティーリングキューは効率的な並列タスクスケジューリングを可能にします。

📚 出典