Byte order (or you are both wro

Lawrence Crowl crowl at rochester.ARPA
Fri Apr 18 04:39:27 AEST 1986


>I wrote:
>> CHALLENGE:  Come up with a scheme for representing numbers, and a sorting
>> scheme in which numbers sort naturally.  Your scheme must deal with variable
>> length character strings and variable size numbers.  That is, you cannot
>> requires strings to be padded with nulls, or numbers to be padded with zeros.

Arch D. Robison wrote:
>...       -4 = AAAAZ   -3 = AAAZ   -2 = AAZ   -1 = AZ 
>  0 = M    1 = Z        2 = ZZ      3 = ZZZ    4 = ZZZZ ...
>

An interesting solution.  I totally failed to consider unary notations.  Just
to keep the answers honest, I will add the requirement that some efficient
form of representation be used.  Radix notation is efficient, but you are not
required to use it.  For extra credit, extend your notation to deal with
non-integral values.  This is easy under current notation if the integral
part is the same.
P
-- 

Lawrence Crowl             716-275-5766        University of Rochester
                                               Computer Science Department
...!{allegra,decvax,seismo}!rochester!crowl    Rochester, New York,  14627



More information about the Comp.lang.c mailing list