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 4 3039
Raghavendra Mahuli wrote: 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 ....
First of all, this is not a language problem. Next time please post to
comp.programming if you need some kind of algorithm. Here you only post
if you have a C++ language problem/question/issue/interesting solution.
Second of all, if you do replace every 'ae' in both strings with 'ai',
it will change nothing WRT positional matches. Just try it and see.
Victor
On Wed, 18 Aug 2004 16:15:36 +0530, Raghavendra Mahuli wrote: 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....
[snip] 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 ....
If you aren't very carefull how you obtain such equivalencies, then the
Problem is not solvable. For example with your equivalency rules above one
can determine that aia<aez of the substitution of ai and ae. However when
you compare afa to those strings you get afa<aia and aez<afa so you get:
afa<aia<aez<afa, which destroys all possibilities of ordering.
Till
--
Please add "Salt and Peper" to the subject line to bypass my spam filter
But ...The rule is that "equivlent values" applies only when u have both
"ae" and "ai" at same position, otherwise we have to sort them like
individual characters.... First of all, this is not a language problem. Next time please post to comp.programming if you need some kind of algorithm. Here you only post if you have a C++ language problem/question/issue/interesting solution.
Second of all, if you do replace every 'ae' in both strings with 'ai', it will change nothing WRT positional matches. Just try it and see.
Victor
who said that afa is less that aia??? It will be defined in a dataset.....It
is assured not to be that chaotic as u mentioned... If you aren't very carefull how you obtain such equivalencies, then the Problem is not solvable. For example with your equivalency rules above one can determine that aia<aez of the substitution of ai and ae. However when you compare afa to those strings you get afa<aia and aez<afa so you get: afa<aia<aez<afa, which destroys all possibilities of ordering. Till
-- Please add "Salt and Peper" to the subject line to bypass my spam filter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jonas Prismesen |
last post by:
Hi!
I have string like this:
string expr = "123/(12*3)";
And I want to actually calculate the mathematical
expression in the string. Is there an easy way do it? Or
do I have to extract all...
|
by: tshad |
last post by:
In my User control, I tried to do this:
***************************************************************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =...
|
by: bsmith1111 |
last post by:
I'm working on a simple calculator similar to the MS Calculator in
visual c++ 6.0. I'm trying to teach myself the visual aspect of c++ on
my own time, so I've decided to jump right into a program...
|
by: krbyxtrm |
last post by:
hi,
i have problem implemting a string parser that parser comman delimited
string:
"str1,str2,str3"
INTO:
1. str1
2. str2
3. str3
*also strings are of any string (no specific string/keyword)
|
by: sturnfie |
last post by:
Hey all, I recently came across the xml.sax libraries and am trying to
use them. I am currently making a string variable, and am attempting
to pass it into a parser instance as follows:
def...
|
by: rushik |
last post by:
Hello,
I am writing one application in which I am getting data as a string "
10 | 20 | 30 | 40 | 50" now my aim is to parse those string, split it
by pipe '|' and get integer outputs in some...
|
by: Peter Michaux |
last post by:
Hi,
I want to know the name of an object's constructor function as a
string. Something like this
<script type="text/javascript">
function Foo(){};
var a = new Foo();
alert('"' +...
|
by: xyz |
last post by:
I have a string
16:23:18.659343 131.188.37.230.22 131.188.37.59.1398 tcp 168
for example lets say for the above string
16:23:18.659343 -- time
131.188.37.230 -- srcaddress
22 ...
|
by: nine72 |
last post by:
Ok, so I have figured out how to parse an custom returned XML doc (actually a string that I made into a doc for testing).
At this point I am attempting to integrate my parse routine into my main...
|
by: stroudg2 |
last post by:
Situation:
I have been tasked to provide a non-intrusive solution to allow .NET web services to grab an incoming SOAP header and process the credentials stored within in such a way that a...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |