[Jprogramming] minmax differences
Devon McCormick
devonmcc at gmail.com
Wed Aug 19 02:11:43 HKT 2009
This problem seems like it may be related to a multi-value version of "Gray
codes": see
http://en.wikipedia.org/wiki/Gray_code for general information and
http://www.jsoftware.com/jwiki/Essays/Gray%20Code and
http://www.jsoftware.com/jwiki/RE%20Boss/Performance%20Records/Gray%20codefor
J implementations.
Briefly, a Gray code is an alternate way of counting in binary with the
objective of minimizing the number of bit changes between successive
entries, e.g.
0 0 0
0 0 1
0 1 1
0 1 0
1 1 0
1 1 1
1 0 1
1 0 0
is the 3-bit sequence: there's only a single-bit difference between any
adjacent pair (and, cyclically, between the first and last one).
More information about the Programming
mailing list