I have to admit that your question does not make much sense to me. While there are hits on google for "binary sort", there doesn't seem to be a specific sorting method with this name. For instance the sorts who seem to have been called this include radix sort and binary insertion sort.
Anyway, here is a solution. I'm not going to say which one it is, I suggest you look into it yourself If you are tempted to hand this in to your teacher.
my $text="qwertyuiopasdfghjklzxcvbnm";
my @ltrs=split //,$text;
my ($val,@set,@unset)=(1);
while ($val) {
push @{(ord($_) & $val) ? \@set : \@unset}, $_
foreach @ltrs;
$val <<= 1;
@ltrs=( splice( @unset, 0, @unset ), splice( @set, 0, @set ) );
}
print join("-",@ltrs)."\n"
PS, please show a bit more effort in your posts. You'll get more support and feedback.
--- demerphq
my friends call me, usually because I'm late....
|