Kolejka
Struktura FIFO, gdzie pierwszy dodany element jest usuwany pierwszy.
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["Kolejka"]:::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;
🧠 Sprawdzenie wiedzy
1 / 1
🧒 Wyjaśnij jak 5-latkowi
Wyobraź sobie kolejkę po lody. Pierwsza osoba w kolejce dostaje loda pierwsza, a nowi ludzie ustawiają się na końcu. Tak działa kolejka!
🤓 Expert Deep Dive
Kolejki bezblokadowe (Michael-Scott) umożliwiają wysoki poziom współbieżności. Bufory cykliczne są wydajne dla stałych rozmiarów. Kolejki wykradania pracy (work-stealing) optymalizują równoległe harmonogramowanie.