Cola

Estructura FIFO donde el primer elemento añadido se elimina primero.

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["Cola"]:::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;

      

🧠 Prueba de conocimiento

1 / 1

🧒 Explícalo como si tuviera 5 años

Imagina esperar en la fila para un helado. La primera persona en la fila es atendida primero, y la gente nueva se une al final. ¡Así funciona una cola!

🤓 Expert Deep Dive

Las colas lock-free (Michael-Scott) permiten concurrencia eficiente. Los buffers circulares son caché-eficientes. Las colas de robo de trabajo (work-stealing) optimizan la programación paralela. Las colas de prioridad usan montículos binarios para ordenar por importancia.

📚 Fuentes