Questions tagged [coding-theory]

The challenge involves the topic of encoding and coding theory, as in error correction and compression. (Not to be confused with program source code).

Filter by
Sorted by
Tagged with
16 votes
10 answers
1k views

Gray code on N symbols

A Gray code is a permutation on binary numbers where incrementing or decrementing a number only ever causes a single bit to change. For example, a Gray code for the binary numbers up to 7 (so, with 3 ...
user avatar
  • 22.2k
21 votes
21 answers
3k views

Fibonacci Encoding

Fibonacci coding is a universal code, which can encode positive integers of any size in an unambiguous stream of bits. To encode an integer \$ n \$: Find the largest Fibonacci number less than or ...
user avatar
  • 22.2k
27 votes
11 answers
2k views

Test if a Gray code is Beckett

Background An \$n\$-bit Gray code is an ordering of \$2^n\$ binary sequences so that adjacent sequences always differ by exactly one bit. A Beckett-Gray code is a special kind of Gray code. In ...
user avatar
  • 64.8k
8 votes
3 answers
888 views

Generate Hamming codes

Given a stream of bits, output the shortest possible Hamming code that encodes it. The steps to generate the Hamming code are as follows, although your submission does not necessarily have to conform ...
user avatar
  • 70.6k
40 votes
14 answers
5k views

Incrementing Gray Codes

Introduction A Gray Code is an alternative to binary representation in which a number is incremented by toggling only one bit, rather than a variable amount of bits. Here are some gray codes along ...
user avatar
7 votes
6 answers
527 views

Generate m-sequences

Introduction Maximum-length sequences, usually known as m-sequences, are binary sequences with some interesting properties (pseudo-noise appeareance, optimal periodic autocorrelation) which make them ...
user avatar
  • 100k
13 votes
7 answers
1k views

Code the Huffman!

Or else he will huff and puff and blow your house down! That was completely irrelevant. This challenge is actually about Huffman coding. The gist of it is the frequency of characters in a given text ...
user avatar
12 votes
1 answer
707 views

An optimization version of the Hadamard problem

First, some definitions. A Hadamard matrix is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. The Hadamard conjecture proposes that a Hadamard matrix of ...
user avatar
6 votes
1 answer
560 views

The Gray area of n-ary codes

Write a program or function that takes a base n and a number x, and returns or outputs the n-...
user avatar
  • 1,339
21 votes
8 answers
4k views

Correct errors using Hamming(7,4)

The Hamming(7,4) code goes back to 1950. Back then Richard Hamming worked as a mathematician at Bell Labs. Every Friday Hamming set the calculating machines to perform a series of calculation, and ...
user avatar
  • 21.8k