need an algo for string sorting

From: Raghavendra Mahuli (raghavendra.ma_at_in.bosch.com)
Date: 08/19/04


Date: Thu, 19 Aug 2004 10:59:32 +0530

Hi,
I have many strings. I have to sort them. But sorting is not according to
ascii but according to a different format (which keeps varying) . So i can
sort them based on sort-order. It is not much of a problem.

But the complex part is "equivalent-values". it can be defined that "ai" and
"ae" are equivalent-values. Then, while sorting two strings, i have to
consider that "ai" and "ae" are equal......only if they come at same
position in both the strings....
For EX1:
str1 - dfahaesdhfkj
str2 - dfahaisds
In str1, ae appears at position 4 and 5
In str2, ai appears also at position 4 and 5....

So they are equivalent.....And i can replace ae in str1 with ai......

EX2:
str3 - haehasdg
str4 - hhsdaiskdn
In str3, ae appears at position 1 and 2
In str4, ai appears also at position 4 and 5....
So here the rule "equivalent -values" does not apply......So i cant replace
"ae" in str3 with "ai".......

In short, the "equivalent-values" applies only when the
"position-matches"...

To add to that such equivalent values are many......
So can you please suggest me some way of solving this problem ....

regards,
Raghavendra



Relevant Pages

  • Re: Solution for sorting an array alpha-numerically
    ... strings up into groups and sorting the groups seperately, ... > so that numeric and alphabetic data sort as seperate groups. ... To the same project as the web page, add the class AlphaNumCompare() ...
    (microsoft.public.dotnet.general)
  • string parser
    ... I have to sort them. ... Then, while sorting two strings, i have to ... In str3, ae appears at position 1 and 2 ...
    (comp.lang.cpp)
  • Re: list view question
    ... > sort data other than strings and columns other than first column. ... > column to perform sorting on and then to do the sorting on that column ... > Public Sub New(ByVal aColumn As Integer, ByVal order As SortOrder, ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: list view question
    ... sorting columns in .net is not as simple as in VB. ... sort data other than strings and columns other than first column. ... exposes compare method to compare two objects. ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: A Fast sorting algorithm for almost sorted data
    ... far my compressor has potential but is nowhere near ready. ... It does however make heavy use of sorting. ... which I am currently calling Run sort. ... entire selected run can be added to the sorted output array. ...
    (comp.compression)