weight (strings)

Let A be an alphabet, aA a letter from A and cA* a string over a. Then the a-weight of c, denoted by wta(c), is the number of times a occurs in c.

If A is an abelian groupMathworldPlanetmath, the Hamming weight wt(c) of c (no ), often simply referred to as “weight”, is the number of nonzero letters in c.


  • Let A={x,y,z}. In the string c:=yxxzyyzxyzzyx, y occurs 5 times, so the y-weight wty(c)=5.

  • Let A=3={0,1,2} (an abelian group) and c:=002001200. Then wt0(c)=6, wt1(c)=1, wt2(c)=2 and wt(c)=wt1(c)+wt2(c)=3.

Title weight (strings)
Canonical name Weightstrings
Date of creation 2013-03-22 15:13:17
Last modified on 2013-03-22 15:13:17
Owner GrafZahl (9234)
Last modified by GrafZahl (9234)
Numerical id 6
Author GrafZahl (9234)
Entry type Definition
Classification msc 94A55
Synonym weight
Related topic KleeneStar
Defines Hamming weight