Weight (strings)

The -weight of a string, for a letter , is the number of times that letter occurs in the string. More precisely, let be a finite set (called the alphabet), a letter of , and a string (where is the free monoid generated by the elements of , equivalently the set of strings, including the empty string, whose letters are from ). Then the -weight of , denoted by , is the number of times the generator occurs in the unique expression for as a product (concatenation) of letters in .

If is an abelian group, the Hamming weight of , often simply referred to as "weight", is the number of nonzero letters in .

Examples

  • Let . In the string , occurs 5 times, so the -weight of is .
  • Let (an abelian group) and . Then , , and .

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

gollark: ```pythondef example(bee,|apioform):||||print(bee,|apioform)||||if|bee|>=|apioform||||||||bee|-=|apioform|*|3||||return apioform```
gollark: Show an example of replacing commas with those.
gollark: How would you use []?!
gollark: You had 17 minutes to consider this you know.
gollark: ```rustenum D { Z, O, T }enum Num { Empty NotEmpty(D, Num)}```↑ canonical Macron integer type
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.