# weight (strings)

Let $A$ be an alphabet, $a\in A$ a letter from $A$ and $c\in A^{*}$ a string over $a$. Then the $a$-weight of $c$, denoted by $\operatorname{wt}_{a}(c)$, is the number of times $a$ occurs in $c$.

If $A$ is an abelian group, the Hamming weight $\operatorname{wt}(c)$ of $c$ (no ), often simply referred to as “weight”, is the number of nonzero letters in $c$.

## Examples

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

• Let $A=\mathbb{Z}_{3}=\{0,1,2\}$ (an abelian group) and $c:=002001200$. Then $\operatorname{wt}_{0}(c)=6$, $\operatorname{wt}_{1}(c)=1$, $\operatorname{wt}_{2}(c)=2$ and $\operatorname{wt}(c)=\operatorname{wt}_{1}(c)+\operatorname{wt}_{2}(c)=3$.

Title weight (strings) Weightstrings 2013-03-22 15:13:17 2013-03-22 15:13:17 GrafZahl (9234) GrafZahl (9234) 6 GrafZahl (9234) Definition msc 94A55 weight KleeneStar Hamming weight