Papers
Topics
Authors
Recent
Search
2000 character limit reached

Binary Search in Buckets (BSB)

Updated 12 July 2026
  • Binary Search in Buckets (BSB) is a method that organizes search operations over bucketized state spaces using weighted metrics and priority ordering.
  • It is applied across domains such as weighted Hamming and cosine similarity search, demand-aware peer selection in peer-to-peer overlays, and overhead imagery sampling with proven efficiency gains.
  • The approach utilizes structured operations and dynamic programming to generate an optimal bucket probing sequence, ensuring exact search results with reduced computational cost.

Binary Search in Buckets (BSB) is used in the cited literature for several bucket-centric procedures in which search, selection, or routing decisions are made over bucketized state spaces rather than by exhaustive element-wise scan. The phrase appears explicitly for a demand-aware peer-selection algorithm in XOR-based peer-to-peer overlays and for a hashed binary search tree sampling scheme for overhead imagery; closely related work on binary-code retrieval realizes the same bucket-ordered pattern by treating binary codes as direct bucket indices in hash tables and probing those buckets in monotone order under weighted Hamming distance or cosine similarity (Ji et al., 25 Sep 2025, Lunga et al., 2017, Weng et al., 2020, Eghbali et al., 2016).

1. Terminological scope and recurring structure

The cited literature uses the phrase in several distinct senses. Across these senses, the common structural motif is that the search object is not an individual datum in isolation but a bucket identifier, a bucket range, or a bucket-organized subtree. This suggests a unifying view in which BSB denotes bucket-level navigation under a domain-specific ordering criterion.

Context Bucket object Main objective
Binary-code retrieval Hash-table buckets indexed by full codes or substrings Exact top-KK search under weighted Hamming distance or cosine similarity
XOR-based overlays Kademlia-style buckets Demand-weighted communication-cost reduction
Overhead imagery sampling Hash buckets with per-bucket BSTs Variance-preserving training-set reduction

In binary-code retrieval, the bucket key is a binary code or substring, and the central problem is to determine the probing sequence over buckets. In XOR overlays, each node organizes peers into logn\log n buckets and chooses one peer per bucket based on local demand. In overhead imagery, locality-sensitive kernel hashing maps patches into buckets, after which a binary search tree is built inside each bucket and sampled by level order until a variance criterion is met (Weng et al., 2020, Ji et al., 25 Sep 2025, Lunga et al., 2017).

2. Bucket-ordered search in binary code space

The most direct bucket-search realization appears in fast search on binary codes by weighted Hamming distance. For a query q{0,1}b\mathbf{q}\in\{0,1\}^b and code g{0,1}b\mathbf{g}\in\{0,1\}^b, the weighted Hamming distance is

dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),

and, for fixed q\mathbf{q}, it is rewritten as

dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).

The dataset is stored in a hash table B[g]B[\mathbf{g}] whose bucket indices are the full binary codes themselves. Search therefore occurs at the level of bucket indices in {0,1}b\{0,1\}^b, not by scanning all stored codes (Weng et al., 2020).

The query-adaptive starting bucket is the code h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b] minimizing the per-bit sum, where

logn\log n0

with ties broken by choosing logn\log n1. Flipping bit logn\log n2 away from logn\log n3 incurs

logn\log n4

Bits are pre-sorted by ascending logn\log n5, and a priority queue is initialized with logn\log n6. The queue key is logn\log n7. Each pop yields the next bucket to probe; two structured transformations, Operation 1 and Operation 2, generate the next candidate bucket indices. Corollary 1 states that every binary code can be generated by repeated applications of these operations starting from logn\log n8, and Proposition 1 states that the binary code with the smallest sum of weights among the un-probed binary codes is always in the priority queue. The resulting probing sequence is therefore globally ordered by increasing weighted Hamming distance, and the single-table search complexity for logn\log n9 probed buckets is

q{0,1}b\mathbf{q}\in\{0,1\}^b0

(Weng et al., 2020).

An analogous problem arises for cosine similarity in binary space. Angular Multi-index Hashing derives the cosine ordering from the Hamming distance tuple q{0,1}b\mathbf{q}\in\{0,1\}^b1, where q{0,1}b\mathbf{q}\in\{0,1\}^b2 counts q{0,1}b\mathbf{q}\in\{0,1\}^b3 flips relative to the query and q{0,1}b\mathbf{q}\in\{0,1\}^b4 counts q{0,1}b\mathbf{q}\in\{0,1\}^b5 flips. For query Hamming weight q{0,1}b\mathbf{q}\in\{0,1\}^b6,

q{0,1}b\mathbf{q}\in\{0,1\}^b7

Within a fixed Hamming radius q{0,1}b\mathbf{q}\in\{0,1\}^b8, cosine similarity increases with q{0,1}b\mathbf{q}\in\{0,1\}^b9. The search is then organized over tuples in decreasing cosine order by a priority-queue traversal with “first anchor” and “second anchor” expansions, yielding an exact angular g{0,1}b\mathbf{g}\in\{0,1\}^b0-nearest-neighbor algorithm in binary space (Eghbali et al., 2016).

3. Long codes, multi-indexing, and sequence-generation efficiency

Single-table bucket probing becomes impractical for long codes because the full table is too sparse. The weighted-Hamming framework therefore splits each code into g{0,1}b\mathbf{g}\in\{0,1\}^b1 disjoint substrings,

g{0,1}b\mathbf{g}\in\{0,1\}^b2

builds a hash table g{0,1}b\mathbf{g}\in\{0,1\}^b3 for each substring position, and defines substring scores

g{0,1}b\mathbf{g}\in\{0,1\}^b4

Each table runs the same bucket-search logic as the single-table case, but on substring buckets. A max-heap of size g{0,1}b\mathbf{g}\in\{0,1\}^b5, keyed by g{0,1}b\mathbf{g}\in\{0,1\}^b6, merges candidates. Proposition 2 states that the binary codes stored in the max-heap at termination have the smallest total sum of weights g{0,1}b\mathbf{g}\in\{0,1\}^b7 among all codes, so the multi-index framework remains exact in weighted Hamming space. Termination is certified by threshold rules such as

g{0,1}b\mathbf{g}\in\{0,1\}^b8

with g{0,1}b\mathbf{g}\in\{0,1\}^b9 implying that the heap already contains the true top-dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),0 (Weng et al., 2020).

A later development addresses the cost of extending the bucket-probing sequence under weighted Hamming distance. Constant Sequence Extension organizes the search space by rightmost flipped bit position and derives a dynamic-programming relation in which each next bucket index is obtained from preceding states. After sorting query-adaptive weights dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),1, the total cost of generating a sequence of length dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),2 is

dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),3

so the complexity is linear in the sequence length rather than quadratic. The method integrates with both single-table and multi-table search, and Theorem 2 states that if the worst candidate in the heap satisfies

dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),4

then the heap already contains the globally smallest weighted-Hamming codes in the database. On SIFT1B, the method achieves speed-up factors dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),5–dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),6 over linear scan using weighted Hamming distance, while remaining exact and yielding systematically higher precision@dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),7 than HD-based MIH (Weng et al., 2023).

4. BSB in XOR-based peer-to-peer overlays

In peer-to-peer networking, BSB is the explicit name of a demand-aware peer-selection algorithm for XOR-based overlays. The model assumes dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),8 nodes labeled dw(q,g)=i=1bwi(qigi),d_w(\mathbf{q},\mathbf{g})=\sum_{i=1}^b w_i(q_i\oplus g_i),9, a ring for baseline connectivity, and up to q\mathbf{q}0 extra directed links per node. Distance in the identifier space is

q\mathbf{q}1

From the perspective of a source node q\mathbf{q}2, the identifier space is partitioned into q\mathbf{q}3 buckets in a Kademlia-style organization. Demand is encoded by a matrix q\mathbf{q}4, where q\mathbf{q}5 is the amount or fraction of traffic from node q\mathbf{q}6 to node q\mathbf{q}7, and the objective is to minimize the demand-weighted communication cost

q\mathbf{q}8

BSB preserves local, greedy XOR-based routing while replacing demand-oblivious neighbor selection inside each bucket with demand-aware peer choice (Ji et al., 25 Sep 2025).

The algorithm considers two strategies. In Half-split, the selected peer is the first bucket position whose cumulative demand reaches at least half of the bucket’s total demand. In Max-demand, the selected peer is the bucket position with maximal demand from the source. Routing remains XOR-based greedy: at each hop, the next hop is the neighbor maximizing

q\mathbf{q}9

that is, the common-prefix length with the destination. Because each node maintains dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).0 neighbors organized in exponentially sized buckets, the XOR-based routing path length is upper bounded by dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).1 (Ji et al., 25 Sep 2025).

The reported behavior is strongly workload dependent. BSB has noticeably lower running time than Permutations, and its gains correlate positively with non-temporal complexity. On Microsoft and ProjecToR traces, BSB yields average cost reduction dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).2 versus Chord, with cost ratio dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).3. On Facebook Cluster C, BSB Max-demand reaches cost ratio dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).4 and Half-split dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).5, both outperforming Permutations at dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).6. On Facebook Cluster A, however, BSB performs worse than Permutations. Across all tested datasets, BSB can offer up to a dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).7 improvement compared to the selected baselines (Ji et al., 25 Sep 2025).

5. Hashed binary search tree sampling in overhead imagery

A different use of BSB appears in training-data selection for very large overhead imagery. Kernelized Locality Sensitive Hashing maps dense image patches dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).8 into binary hash codes

dw(g)=i=1bw^i(gi).d_w(\mathbf{g})=\sum_{i=1}^b \hat{w}_i(g_i).9

where

B[g]B[\mathbf{g}]0

Patches are grouped into hash buckets, bucket keys are sorted, the middle key is chosen as root, and a binary search tree is built per bucket. The sampling procedure then traverses the tree in level order and computes

B[g]B[\mathbf{g}]1

The selected subtree is the first depth B[g]B[\mathbf{g}]2 such that B[g]B[\mathbf{g}]3, so the retained sample preserves a chosen fraction of the bucket variance while discarding redundant patches (Lunga et al., 2017).

The method was evaluated on a human settlement detection task with 175,000 labeled image patches of size B[g]B[\mathbf{g}]4. BSB sampling was used to select 60,000 representative patches for training. With the radial basis function kernel, the sampled model achieved accuracy B[g]B[\mathbf{g}]5 on Settle and B[g]B[\mathbf{g}]6 on Non-Settle, compared with B[g]B[\mathbf{g}]7 and B[g]B[\mathbf{g}]8 for the full 175,000-patch model. Loss curves show that hashing plus BST sampling exhibits less overfitting than the no-hashing baseline and slightly better behavior than hashing without BST sampling. On a large unseen Baghlan scene of size B[g]B[\mathbf{g}]9, the paper reports “matching results” between the BSB-trained model and the full-data model (Lunga et al., 2017).

6. Formal limits, adjacent formulations, and recurring limitations

The most general theoretical account of bucket-based search in the provided literature is the framework of bucketing codes. There, a bucketing code is a collection of bucket pairs {0,1}b\{0,1\}^b0, success probability is

{0,1}b\{0,1\}^b1

and expected work is

{0,1}b\{0,1\}^b2

The core information-theoretic quantity is bucketing information

{0,1}b\{0,1\}^b3

Theorem 10.1 gives a lower bound on all bucketing codes, and Theorem 10.2 shows that random bucketing codes attain the bound asymptotically. In the Bernoulli example with agreement probability {0,1}b\{0,1\}^b4, the work exponent improves from the classical {0,1}b\{0,1\}^b5 to {0,1}b\{0,1\}^b6, and when one sequence from each pair belongs to a known set of size {0,1}b\{0,1\}^b7, pairing can be done using {0,1}b\{0,1\}^b8 comparisons (0810.4182).

Several adjacent formulations reinforce the same design pattern. “Binary Search with Distributional Predictions” alternates a distribution-guided bisection phase with endpoint searches over left and right buckets of size {0,1}b\{0,1\}^b9, yielding expected query complexity h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]0, where h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]1 is entropy and h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]2 is earth mover’s distance between the true and predicted distributions. “A novel quantum grid search algorithm and its application” studies h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]3 non-empty buckets and marked paths across their Cartesian product; its quantum grid search has expected runtime of order h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]4, and the binary-search extension over cost intervals runs in h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]5 in the homogeneous case. For sorted arrays of floating-point numbers, an indexing technique based on

h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]6

builds a bucket table that resolves the interval search in h=[h1,,hb]\mathbf{h}=[h_1,\dots,h_b]7 per query and can produce throughput up to two orders of magnitude larger than the classic binary search (Dinitz et al., 2024, Shukla et al., 2019, Cannizzo, 2015).

The limitations are likewise recurrent. In peer selection, BSB performs best when spatial demand is skewed and may underperform Permutations on some workloads. In weighted-Hamming retrieval, single-table search becomes too sparse for long codes, motivating multi-indexing and additional memory structures. In floating-point indexing, applicability depends on bucket-feasibility conditions and index-size constraints. In bucketing-code theory, major results are asymptotic, the model is i.i.d. and data-independent, and the Bernoulli analysis relies on a key conjectural inequality. Taken together, these results indicate that BSB is best understood not as a single canonical algorithm but as a research pattern: bucket organization supplies the state space, and the substantive contribution lies in how buckets are ordered, probed, merged, or sampled under the problem’s metric, demand model, or variance objective (Ji et al., 25 Sep 2025, Weng et al., 2020, 0810.4182).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Binary Search in Buckets (BSB).