{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "data-structure",
  "slug": "data-structures/queues",
  "name": "Queues",
  "section": "Data Structures",
  "canonical_definition": "A queue is a linear data structure that enforces first-in, first-out (FIFO) access \u2014 elements are inserted (enqueued) at the rear and removed (dequeued) from the front \u2014 providing O(1) enqueue, dequeue, and peek.",
  "complexity": {
    "enqueue": "O(1)",
    "dequeue": "O(1)",
    "peek": "O(1)",
    "search": "O(n)",
    "space": "O(n)"
  },
  "confidence": "high",
  "last_verified": "2026-06-01",
  "source_count": 4,
  "url": "https://thecodex.expert/coding/data-structures/queues/",
  "concept_relationship": {
    "requires_first": [
      "data-structures/arrays",
      "data-structures/linked-lists"
    ],
    "enables": [
      "algorithms/searching"
    ],
    "commonly_confused_with": [
      "Python list.pop(0) is O(n) \u2014 use deque.popleft()",
      "priority queue != FIFO queue",
      "queue (FIFO) vs. stack (LIFO) determines DFS vs. BFS"
    ]
  },
  "sources": [
    {
      "num": 1,
      "citation": "CLRS 4th ed. \u00a710.1 \u00a722.2",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "POSIX.1-2017 mq_send",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "Python collections.deque docs",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "Knuth TAOCP Vol.1 \u00a72.2.1",
      "tier": 1
    }
  ]
}