473,770 Members | 6,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript: How do I find all possible letter combinations of given letters though ..

3 New Member
I would like to have a javascript that calculates all possible letter combinations of given letters with number of characters in the output.

However, not the same letter from the given letters more than once, except it is in the given word more than once.

For example:
- Named letters "ABCDE"
- Output letters are 4
- Results could be OKAY: "CBED", "ACED", "DEAB", "BCDE" etc
- But NOT OKAY: "AABC" or "BCCC"

However, if
- Named letters "ABCCD"
- Output letters are 4
- Results could be OKAY: "CBEC", "ACCD", "DABC", "ABCC" etc
- But NOT OKAY (more than 2 C's, as it is in the given word): "AABC" or "BCCC"
Jul 31 '13 #1
2 3157
Dormilich
8,658 Recognized Expert Moderator Expert
the number of possibilities is given by Permutation.

for the implementation I’d use an array and lots of loops.

note however, that the number of your results get soon very big (5 out of 10 is already > 30,000; 10 out of 20 is > 670,000,000,000 ).
Jul 31 '13 #2
Wesso
3 New Member
Thanks Dormilich for your reply
Jul 31 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1376
by: Anna | last post by:
Hi all. I have a rather short question: How can I in xsl to get a letter, given its position in the alphabet, e.g. given number 5, return a letter 'e'? Is it possible in pure xsl or do I need to use java extension? Thank you very much for help. Anna
7
5375
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 not repeat in the combinations. So, ababab, abcabc would not be alowed but, abcbca, abcbac... would all be alowed.
1
1928
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 passwords to our students. But then, I realized that there were many duplicates. Somebody can give me the code to avoid the duplicates? Or a query to delete the duplicates in the tblOutput?
3
2668
by: D r . P r o z a c | last post by:
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,
6
4066
by: chiara | last post by:
Hi everybody! I am just at the beginning as a programmer, so maybe this is a stupid question...Anyway,I need to write a function in C to generate generate all possible strings of given length given a set of characters (allowing repetitions of the same character) For example given the characters 'E' and 'H' and maximum length 3 the function should generate the sequences
0
1075
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 C#.Net 2005?
1
1637
by: Marc Gravell | last post by:
I haven't let it run to completion, but how about below; it uses a char rather than lots of strings to save the GC some work... it only goes 5 levels deep on the stack, so shouldn't blow up... Marc static void Main() { char data = new char; Loop(data, 0);
6
2324
by: Jimmy45 | last post by:
Hello, I am writing a "scrabble code" on Python. I have some problem with getting possible words from the given letters. For example: Given letters are: 'c', 'r', 'n', '*' Here '*' can be any letter. Possible words: 'cry', 'corn', 'run', etc. proper_word_list is a file containing all the english words. score_of_word is a function that computes the score of the word. hand is the letters that are given to the player
4
2712
by: yogeshjain91 | last post by:
how to find factorial of a given no.and how to find sum of odd and even no.
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5312
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
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 we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.