previous | start | next

LSD - Sorting Strings

Instead of 10 digits, LSD uses 256 possible characters for each position of Strings.

It is appropriate for sorting strings that are all the same length; that is, for strings of fixed length

A bigger the character set, will require a bigger count array.

LSD uses on the order of

      7WN + 3WR
   

array accesses where

 W is the (fixed) length of the strings
 N is the number of strings to sort
 R is the number of characters in the character set.
   

For N social security numbers without dashes

 W = 9
 R = ?

So

 7WN + 3WR = 63N + 270    (for R = 10; just the digits 0 - 9)

 7WN + 3WR = 63N + 6912   (for R = 256; all 256 ascii characters)
   

Is LSD faster than Java's Arrays.sort for Strings?



previous | start | next