Charles Explorer logo
🇬🇧

Linear time construction of a compressed Gray code

Publication at Faculty of Mathematics and Physics |
2013

Abstract

An n-bit (cyclic) Gray code is a (cyclic) ordering of all n-bit strings such that consecutive strings differ in exactly one bit. We construct an n-bit cyclic Gray code whose graph of transitions is isomorphic to an induced subgraph of the d-dimensional hypercube where d equals the ceiling of lg n.

This allows to represent the code so that only Θ(log log n) bits per n-bit string are needed. We provide an explicit description of an algorithm which generates the transition sequence of such a code in linear time with respect to the output size.