Byte order (or you are both wrong)
Lawrence Crowl
crowl at rochester.ARPA
Mon Apr 21 23:32:12 AEST 1986
In article <2568 at utcsri.UUCP> greg at utcsri.UUCP (Gregory Smith) writes:
>In article <17162 at rochester.ARPA> crowl at rochester.UUCP (Lawrence Crowl) writes:
>>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.
>How about prepending the digit count to big-endian digit strings?
>so 32 and 126 become 232 and 3126, and a lexical comparison gives
>3126 > 232. Of course, leading zeroes in the significand cannot be used. ...
The problem with this scheme is that it assumes a constant size "length" field.
This is the best that I have yet seen though.
>>Note that many part numbering schemes have intermixed letters and digits.
>But what significance do letters have? do you want them to be ignored,
>or to be assigned a dictionary order with the numbers?
This is part of the problem!
>P.S. this rather obscure scenario hardly seems reason to state that
>little- and big-endians are both wrong.
Sort the following list of "words": 302, 3B2, -42, 132, 26, AD, ab, 74LS00
--The damn poster program wants more lines.
--It says "more included lines than new next".
--I've said all I want to say.
--You want more lines?
--Take this!
--Feed it to your line eater!
--Burp!
--
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