Sorting Similar Vectors Boris Aronov1 Summary: Sorting Similar Vectors Boris Aronov1 and John Iacono2 Abstract We show how to sort a sequence of k n-bit vectors presented as a list of single- bit changes between consecutive vectors, in O((n + k) log n) deterministic time. An application of this result to a computational problem in arrangements of geometric shapes is presented. Keywords Algorithms, Gray codes, computational geometry. Problem We are given a sequence S = (v1, . . . , vk) of k n-bit vectors, presented as follows: The first bit vector is all zeros and each subsequent vector vi is obtained from the previous vector vi-1 by flipping a single bit in position bi, 0 bi < n. S is represented as b2, b3, . . . , bk. The problem is to sort the sequence v1, v2, . . . , vk. More formally, we seek a labeling S {1, . . . , k}, vi ci, such that ci cj iff vi vj. A randomized algorithm with the same expected running time is easy to construct. Below we show how to use our algorithm to detect faces with the same inclusion pattern, in a geometric arrangement. Solution Without loss of generality in the remainder of this note we assume that n is a power of two. Collections: Computer Technologies and Information Sciences