question abouut string sort
Posted
by davit-datuashvili
on Stack Overflow
See other posts from Stack Overflow
or by davit-datuashvili
Published on 2010-06-09T06:08:36Z
Indexed on
2010/06/09
6:12 UTC
Read the original article
Hit count: 155
algorithm
i have question from programming pearls
problem is following
show how to use lomuto's partitioning scheme to sort varying length bit strings in time proportional to the sum oof their length
and algorithm is following
each record in x[0..n-1] has an integer length and pointer to the array bit[0..length-1] code
void bsort(l,u,depth){
if (l>=u)
return;
for (int i=l;i<u;i++)
if (x[i].length<depth)
swap(i,l++);
m=l;
if (x[i].bit[depth] ==0)
swap(i,m++);
bsort(l,m-1,depth+1);
bsort(m,u,depth+1);
please help me i need following things 1. how this algorith works 2.how implement in java?
© Stack Overflow or respective owner