{
  "id": "algorithms",
  "name": "Algorithms",
  "path": "/algorithms/",
  "question": "Walk through an algorithm",
  "description": "Algorithm entries keep the input constraint, the invariant, and the cost together. The goal is to know when a familiar method still applies, not just to repeat its name.",
  "entries": [
    {
      "id": "algorithms/hash-table-lookups",
      "title": "Average and Worst-Case Hash Table Lookups",
      "url": "https://www.fieldnotely.xyz/algorithms/hash-table-lookups/",
      "summary": "A hash lookup is O(1) on average when the hash spreads keys evenly and the load factor stays bounded, but the bound is expected rather than worst-case. Collisions concentrated in one bucket, from a weak hash or adversarial keys, degrade a lookup to O(n).",
      "aliases": [
        "hash lookup complexity",
        "O(1) average lookup",
        "hash collision worst case"
      ],
      "kind": "concept",
      "topic": "hashing",
      "scope": "Hash tables in standard libraries",
      "updated": "2026-11-29"
    },
    {
      "id": "algorithms/binary-search-left-boundary",
      "title": "Finding the Left Boundary with Binary Search",
      "url": "https://www.fieldnotely.xyz/algorithms/binary-search-left-boundary/",
      "summary": "Binary search finds the first element that satisfies a monotone predicate by keeping a half-open range and moving the lower bound past every false midpoint. The predicate must be false on a prefix and true on the suffix, and the final lower bound is the answer.",
      "aliases": [
        "lower bound binary search",
        "first true binary search",
        "leftmost insertion point"
      ],
      "kind": "guide",
      "topic": "search",
      "scope": "Language-independent; sorted arrays",
      "updated": "2026-11-29"
    },
    {
      "id": "algorithms/stable-sorting-equal-keys",
      "title": "Stable Sorting with Equal Keys",
      "url": "https://www.fieldnotely.xyz/algorithms/stable-sorting-equal-keys/",
      "summary": "A stable sort preserves the original relative order of records that compare equal, so only ties are affected. Stability matters when an earlier ordering carries meaning, such as a secondary key or an arrival sequence, and it is a property of the algorithm rather than the comparator.",
      "aliases": [
        "sort stability",
        "stable sort",
        "equal-key order"
      ],
      "kind": "concept",
      "topic": "sorting",
      "scope": "Comparison sorts; standard library sort APIs",
      "updated": "2026-11-29"
    },
    {
      "id": "algorithms/bfs-queue",
      "title": "The Queue in Breadth-First Search",
      "url": "https://www.fieldnotely.xyz/algorithms/bfs-queue/",
      "summary": "BFS uses a FIFO queue so that vertices are expanded in discovery order, which is nondecreasing distance from the source; that ordering is what makes the first visit to a vertex its shortest path. A stack expands the newest vertex first, which produces depth-first search instead.",
      "aliases": [
        "BFS queue",
        "FIFO frontier",
        "queue versus stack traversal"
      ],
      "kind": "concept",
      "topic": "graphs",
      "scope": "Graph traversal; unweighted shortest paths",
      "updated": "2026-11-29"
    }
  ]
}
