473,486 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Identify letter combinations where order is not important?

Hi,

I want to identify combinations of letters (a-z)... to make the combination
unique, but where the order of these letters is not important.

For example:
'er' and 're' should have the same unique identity.

--
Thanks in advance,
Peter.

Nov 13 '05
3 2653
" D r . P r o z a c" <pr****@gmx.net> wrote:
Hi,

I want to identify combinations of letters (a-z)... to make the combination
unique, but where the order of these letters is not important.

For example:
'er' and 're' should have the same unique identity.


This is not a question about the C programming language. Either rephrase it
or find somewhere more appropriate. If you can come up with a more complete
description of what you want your program to do you could post to
comp.programming

--
Simon.
Nov 13 '05

" D r . P r o z a c" <pr****@gmx.net> schrieb im Newsbeitrag
news:bm**********@news.hccnet.nl...
Hi,

I want to identify combinations of letters (a-z)... to make the combination unique, but where the order of these letters is not important.

For example:
'er' and 're' should have the same unique identity.


If I don't misunderstand what you want to do...

You could use an array of structs like in
struct
{
char letters[SOME_SIZE_LARGE_ENOUGH_TO_HOLD_THE_LONGEST_SEQUENC E];
unsigned long id;
}[ENOUGH_TO_HOLD_ALL_PATTERNS] = {0};

Now iterate through the structs, fill the letters member of the structs with
your character sequences and qsort the letter arrays in _descending_ order
(so the zeroes from the initialisation will remain at the end of the char
arrays), then qsort the structs themselves, using the "letters" members as
sort criteria.
Finally you iterate through the array of structs again, assign values to the
"id" members (starting with 0 and only incrementing if struct[n].letters
compares unequal to the struct[n-1].letters, and you are done.

HTH
Robert
Nov 13 '05
" D r . P r o z a c" <pr****@gmx.net> writes:
Hi,

I want to identify combinations of letters (a-z)... to make the combination
unique, but where the order of these letters is not important.

For example:
'er' and 're' should have the same unique identity.


Simply choose a consistent ordering and order the letters
appropriately every time you encounter them: use the ordered
version as the identity.

-Micah
Nov 13 '05

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
9425
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
3
7848
by: Jonathan | last post by:
Hi all! For a match schedule I would like to find all possible combinations of teams playing home and away (without teams playing to themselves of course). I now the simple version works...
7
5358
by: Micheal Artindale | last post by:
I am looking at creating list of letter combinations. letters a-h 6 letters per combination letter can repeat its self in the combination, but not next to its self and, a series of letter can...
1
1905
by: Videotron | last post by:
Thanks to James A. Fortune in this Newsgroups "Creating random letter combinations", I execute the code he proposes and there were 500,000 combinations generated. This is more than we need to give...
15
2382
by: Thomas Cameron | last post by:
Hello all, I have an array of values which I would like to generate all possible combinations for. And example would be the values "a,b,c". This would produce the following: a ab abc ac b
10
1965
by: QQ | last post by:
for instance, I read a char from the input and I need to decide whether it is a letter or a number What I am doing is char a; ...... // read a int true = false; if(( (a >='0') && (a <='9')) | |...
3
2140
by: ASP Developer | last post by:
I have a generic list of objects. These objects have a text field that contains a letter for the first character and numbers for the next three. For example, "A001". I need to sort these by...
4
2145
by: joboils | last post by:
I'm at a pretty early stage of learning php and I'm looking to be able to examine a string and tell which each character in that string is - a letter or a number. I've tried php.net but I'm either...
0
1062
by: softengg | last post by:
Hi there, any please tell me how to find out all the possible combinations of letters in a word. Suppose we have a word "eat", and the possible combinations would be eat, aet, tea,tae, etc...using...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
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...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.