Move-to-front algorithm: Difference between revisions

Content added Content deleted
m (→‎version 2: changed some comments and whitespace, used a template for output.)
m (→‎version 2: changed a comment.)
Line 1,752: Line 1,752:
!= /*set the encode string to a null. */
!= /*set the encode string to a null. */
do m=1 for words($); n=word($, m) +one /*decode the sequence table string. */
do m=1 for words($); n=word($, m) +one /*decode the sequence table string. */
y=substr(@@, n, 1); !=! || y /*the decode symbol for the N word. */
y=substr(@@, n, 1); !=! || y /*the decode symbol for the N word.*/
@@=y || delstr(@@, n, 1) /*rebuild the symbol table string. */
@@=y || delstr(@@, n, 1) /*rebuild the symbol table string. */
end /*m*/ /* [↑] the move─to─front decoding. */
end /*m*/ /* [↑] the move─to─front decoding. */