I do not know if I understand the question correctly, but I'll try
to help with the sorting stuff.  I talk about radix sort, because
JCW mentioned this in his initial post.  Radix sort can also be
used well on the individual columns.  Just append virtual zeros to
short values.  If You want to sort several columns at once using
radix sort You have to make the variable length values all the same
length.

I assume, that to each column an invisible sidecolumn is attached,
that contains the sortposition of the column.  I.e. for col[i] there is
an asociated col*[i].  When col[i][j1] sorts to be first then
col*[i][j1]=1.  And the col[i][j10] that gets position 10 after a
sort will have col*[i][j10]=10.

Then just concatenate the bitpatterns of the col* in the order of
Your columnwise sort and do a bitlevel radixsort. If You want to
include one column in reverse sort orfer, just append its negated
bitpattern.

Example:

col[1]          col[2]          col[3]
www             yahoo           com
cvs             sourceforge     net
metakit         equi4           com

columnwise sorting will yield
col*[1]         col*[2]         col*[3]
3               3               1
1               2               3
2               1               2

to sort col[1] col[2] col[3] use
11 11 01
01 10 11
10 01 10
radix sort will make this into 2 3 1

to sort col[2] col[3] col[1] use
11 01 11
10 11 01
01 10 10
radix sort will make this into 3 2 1

to sort col[3] reverse col[1] col[2] use
01 00 11
11 10 10
10 01 01
radix will result in 1 3 2

to sort reverse col[2] use
00
01
10
radix sort will produce 1 2 3

I hope this is an answer to the original question.

-- Robert S.
_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to