Anonymous user
Move-to-front algorithm: Difference between revisions
m
→version 2: changed some comments and whitespace, used a template for output.
No edit summary |
m (→version 2: changed some comments and whitespace, used a template for output.) |
||
Line 1,743:
parse arg xxx; if xxx='' then xxx= 'broood bananaaa hiphophiphop' /*use the default?*/
one=1 /*(offset) for this task's requirement.*/
do j=1 for words(xxx); x=word(xxx, j)
@= 'abcdefghijklmnopqrstuvwxyz'; @@=@
$= /*set the decode string to a null. */
!= /*set the encode string to a null. */
say ' word: ' left(x, 20) "encoding:" left($, 35) word('wrong OK', 1+(!==x) )
end /*j*/
<pre>
word: broood encoding: 1 17 15 0 0 5 OK
|