Build a dispatch review that separates four questions. A BK-tree finds labels near a misspelled incident term, a vantage-point tree selects an exact nearest depot under Manhattan distance, a centroid decomposition reports distance to a marked depot in a fixed road tree, and a two-level perfect hash checks one frozen case-ID set. Record the metric and input version beside each answer. The BK and centroid examples admit limited additions, while the vantage and perfect-hash indexes need a rebuild for changed snapshots. Do not substitute one query type for another just because all four use tree-shaped records.
Project: audit metric searches, marked depots, and static membership
Acceptance trace
Index invoice, invoces, invoices, incident, invoker, and voice. A radius-one query for invoice returns invoice and invoices. Depot central at (47,47) is five units from (50,45); west at (83,29) is four from (80,30). In the seven-node road tree, marking node four gives node two a nearest-marked distance of three, and marking six gives node five distance one. A frozen seven-ID perfect hash accepts 61 and rejects 62, even if the absent ID maps to an occupied secondary slot. Duplicate label and mark operations should leave logical contents unchanged.
Failure and cost review
Generate short random labels and compare BK-tree radius answers with direct edit-distance scans. Compare vantage answers with exhaustive distance and ID tie ordering, especially when several points lie exactly on the pivot radius. Compare centroid marks with a breadth-first road distance oracle. Build many small perfect-hash snapshots and test every inserted key plus random absent IDs. Force a malformed road cycle, an out-of-field case ID, and a text normalization mismatch. A randomized hash retry limit is a construction failure that must be reported, never converted into a silent missing-key result. Distinguish metric computation costs from tree traversal counts.
Common Mistakes
- Do not discard BK children solely because the parent label misses the radius.
- Do not prune a vantage branch across an intersecting radius boundary.
- Do not use a mark-only centroid summary to unmark a depot.
- Do not treat an occupied perfect-hash slot as exact key equality.
