48
правок
Изменения
Pseudocode2 bugfix
'''Segment''' segment[m]
'''double''' l = 0
'''for''' i = 0 '''to''' m-1
segment[i].left = l
segment[i].right = l + probability[i]
segment[i].character = letters[i]
'''string''' ArithmeticDecodingarithmeticDecoding(code: '''double''', length: '''int'''): defineSegments(letters, probability)
'''string''' s = ""
'''for''' i = 0 '''to''' length-1 '''for''' j = 0 '''to''' m-1 '''if''' code >= segment[j].left '''and''' code < segment[j].right''<font color=green>// segment {{---}} массив, заполненный в результате выполнения метода defineSegments</font>'' s += s + segment[j].character
code = (code – segment[j].left) / (segment[j].right – segment[j].left)
'''break'''