12 lines
181 B
Text
12 lines
181 B
Text
|
|
H[x] :=
|
||
|
|
{
|
||
|
|
N = length[x]
|
||
|
|
sum = 0
|
||
|
|
for [symbol, count] = countToDict[charList[x]]
|
||
|
|
sum = sum + count/N log[count/N, 2]
|
||
|
|
|
||
|
|
return negate[sum]
|
||
|
|
}
|
||
|
|
|
||
|
|
println[H["1223334444"]]
|