question abouut string sort
- by davit-datuashvili
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?