in reply to Bucket sort - reducing memory requirements and preserving speed

You can not implement bucket sort using linked lists while still being O(N).

The right solution is to use bigger buckets and then to recurse.

Anyway, is this home work? because otherwise you should probably go for some CPAN module, for instance Sort::Key::Radix:

use Sort::Key::Radix qw(isort); my @data = map int, qw(2 53 23456 75434532 233 45654 665446 33 234 5 6 +665 3 2 23 43 62553 27263 2 33 75434532 987762 34455 22 3345 +24 567 54 43 12 23); my @sorted = isort @data; print "@sorted";
  • Comment on Re: Bucket sort - reducing memory requirements and preserving speed
  • Download Code