Recursive indexing: Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error fixes + other fixes using AWB (10065)
some obvious copy-editing
Line 8:
Recursive indexing itself is a method to write the successive differences of the number after extracting the maximum value of the alphabet set from the number, and continuing recursively till the difference falls in the range of the set.
 
Recursive indexing with a 2 -letter alphabet is called [[Unaryunary code]].
 
==Encoding==
To encode a number ''N'', keep reducing the maximum element of this set (''S''<sub>max</sub>) from ''N'' and output ''S''max for each such difference, stopping when the number lies in the half closed half open
range [0–0&nbsp;–&nbsp;''S''<sub>max</sub>).
 
===Example===
Let set ''S''&nbsp;=&nbsp;[0 1 2 3 4 … 10], be aan 11 -element set, and we have to recursively index the value N=49.
 
According to this method, we need to keep removing 10 from 49, and keep proceeding till we reach a number in the 0–10 range.
 
So the values are 10 (''N''&nbsp;=49–10&nbsp;49&nbsp;–&nbsp;10 = &nbsp;39), 10 (''N''&nbsp;=39–10&nbsp;39&nbsp;–&nbsp;10&nbsp;=&nbsp;29), 10 (''N''&nbsp;=29–10&nbsp;29&nbsp;–&nbsp;10&nbsp;=&nbsp;19), 10 (''N''&nbsp;=19–10&nbsp;19&nbsp;–&nbsp;10&nbsp;=&nbsp;9), 9.
Hence the recursively indexed sequence for ''N''&nbsp;=&nbsp;49 with set ''S'', is &nbsp;10,&nbsp;10,&nbsp;10,&nbsp;10,&nbsp;9.
 
==Decoding==
Line 26:
 
===Example===
Continuing from above example we have &nbsp;10&nbsp;+&nbsp;10&nbsp;+&nbsp;10&nbsp;+&nbsp;10&nbsp;+&nbsp;9 &nbsp;= &nbsp;49.
 
==Uses==
This technique is most commonly used in [[Runrun-length encoding]] systems to encode longer runs than the alphabet sizes permit.
 
==References==