Misplaced Pages

Weight (strings)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

The a {\displaystyle a} -weight of a string, for a letter a {\displaystyle a} , is the number of times that letter occurs in the string. More precisely, let A {\displaystyle A} be a finite set (called the alphabet), a A {\displaystyle a\in A} a letter of A {\displaystyle A} , and c A {\displaystyle c\in A^{*}} a string (where A {\displaystyle A^{*}} is the free monoid generated by the elements of A {\displaystyle A} , equivalently the set of strings, including the empty string, whose letters are from A {\displaystyle A} ). Then the a {\displaystyle a} -weight of c {\displaystyle c} , denoted by w t a ( c ) {\displaystyle \mathrm {wt} _{a}(c)} , is the number of times the generator a {\displaystyle a} occurs in the unique expression for c {\displaystyle c} as a product (concatenation) of letters in A {\displaystyle A} .

If A {\displaystyle A} is an abelian group, the Hamming weight w t ( c ) {\displaystyle \mathrm {wt} (c)} of c {\displaystyle c} , often simply referred to as "weight", is the number of nonzero letters in c {\displaystyle c} .

Examples

  • Let A = { x , y , z } {\displaystyle A=\{x,y,z\}} . In the string c = y x x z y y z x y z z y x {\displaystyle c=yxxzyyzxyzzyx} , y {\displaystyle y} occurs 5 times, so the y {\displaystyle y} -weight of c {\displaystyle c} is w t y ( c ) = 5 {\displaystyle \mathrm {wt} _{y}(c)=5} .
  • Let A = Z 3 = { 0 , 1 , 2 } {\displaystyle A=\mathbf {Z} _{3}=\{0,1,2\}} (an abelian group) and c = 002001200 {\displaystyle c=002001200} . Then w t 0 ( c ) = 6 {\displaystyle \mathrm {wt} _{0}(c)=6} , w t 1 ( c ) = 1 {\displaystyle \mathrm {wt} _{1}(c)=1} , w t 2 ( c ) = 2 {\displaystyle \mathrm {wt} _{2}(c)=2} and w t ( c ) = w t 1 ( c ) + w t 2 ( c ) = 3 {\displaystyle \mathrm {wt} (c)=\mathrm {wt} _{1}(c)+\mathrm {wt} _{2}(c)=3} .

This article incorporates material from Weight (strings) on PlanetMath, which is licensed under the Creative Commons Attribution/Share-Alike License.

Category: