Input: x, , q, , , | Output: , , | (1.1) begin | (1.2) Sort query, q in ascending order, yielding order array . | (1.3) Select prime dimension, . | (1.4) Select data order vector as the search order. | (1.5) Compute and . | (1.6) Compute according to (5). | (1.7) Compute initial search range, , according to (6). | (1.8) Use binary search to find . | (1.9) foreach in order of increasing distance from do | (1.10) If is out of search range , terminate. | (1.11) Compute distance = dist using the ordered partial distance method. | (1.12) if then | (1.13) Insert , in results list, , . | (1.14) Increment (up to ). | (1.15) if then | (1.16) Reduce the search range, . | (1.17) Recompute according to (6). | (1.18) end | (1.19) end | (1.20) end | (1.21) end |
|