Generating m-Ary Gray Codes and Related Algorithms
In this work, we systematize several implementations of the Gray code over an alphabet with m≥2 elements, which we present in C code so that they can be used directly after copying from the text. We consider two variants—reflected and modular (or shifted) m-ary Gray codes. For both variants, we pres...
Gespeichert in:
Veröffentlicht in: | Algorithms 2024-07, Vol.17 (7), p.311 |
---|---|
Hauptverfasser: | , , , |
Format: | Artikel |
Sprache: | eng |
Schlagworte: | |
Online-Zugang: | Volltext |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | In this work, we systematize several implementations of the Gray code over an alphabet with m≥2 elements, which we present in C code so that they can be used directly after copying from the text. We consider two variants—reflected and modular (or shifted) m-ary Gray codes. For both variants, we present the ranking and unranking functions, as well as algorithms for generating only a part of the code, more precisely the codewords between two given vectors. Finally, we give algorithms that generate a maximal set of non-proportional vectors of length n over the given alphabet in a Gray code. |
---|---|
ISSN: | 1999-4893 1999-4893 |
DOI: | 10.3390/a17070311 |