A Dynamic Programming Approach to Generating a Binary Reflected Gray Code Sequence
نویسندگان
چکیده
A binary reflected Gray code (Gray code for short) is a one-to-one function G(i) of the integers 0 • i • 2 – 1 (for some pre-selected value of n) to binary numbers such that the binary number for G(i) and G(i+1) differ in exactly one bit. For example, with N = 3, the Gray codes (written in binary) are 000, 001, 011, 010, 110, 111, 101, 100. In this paper, we describe a dynamic programming algorithm and associated storage efficient data structure that is capable of generating a complete n-bit binary reflected Gray code sequence in provably optimal Θ(2) time and space. The algorithm uses the inherent redundancy in the elements of a binary reflected Gray code sequence to avoid recalculation of repeated subsequences. The resulting method is an optimal, convenient, and elegant solution to working with binary reflected Gray codes.
منابع مشابه
Mirroring and interleaving in the paperfolding sequence
Three equivalent methods of generating the paperfolding sequence are presented as well as a categorisation of runs of identical terms. We find all repeated subsequences, the largest repeated subsequences and the spacing of singles, doubles and triples throughout the sequence. The paperfolding sequence is shown to have links to the Binary Reflected Gray Code and the Stern-Brocot tree. Discipline...
متن کاملDesign of Logic Network for Generating Sequency Ordered Hadamard Matrix H
A logic network to produce the sequency ordered Hadamard matrix H based on the property of gray code and orthogonal group codes is developed. The network uses a counter to generate Rademacher function such that the output of H will be in sequency. A general purpose shift register with output logic is used to establish a sequence of period P corresponding to a given value of order m of the Hadam...
متن کاملOn binary reflected Gray codes and functions
The Binary Reflected Gray Code function b is defined as follows: If m is a nonnegative integer, then b(m) is the integer obtained when initial zeros are omitted from the binary reflected Gray code of length m. This paper examines this Gray code function and its inverse and gives simple algorithms to generate both. It also simplifies Conder’s result that the jth letter of the kth word of the bin...
متن کاملOn the Conversion between Binary Code and Binary-Reflected Gray Code on Boolean Cubes
We present a new algorithm for conversion between binary code and binary{re ected Gray code that requires approximately 2K 3 element transfers in sequence for K elements per node, compared to K element transfers for previously known algorithms. For a binary cube of n = 2 dimensions the new algorithm degenerates to yield a complexity of K 2 + 1 element transfers, which is optimal. The new algori...
متن کاملAn Application of the ABS LX Algorithm to Multiple Sequence Alignment
We present an application of ABS algorithms for multiple sequence alignment (MSA). The Markov decision process (MDP) based model leads to a linear programming problem (LPP), whose solution is linked to a suggested alignment. The important features of our work include the facility of alignment of multiple sequences simultaneously and no limit for the length of the sequences. Our goal here is to ...
متن کامل