473,410 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

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

3
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 3147
Dormilich
8,658 Expert Mod 8TB
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
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
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...
7
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
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...
3
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...
6
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...
0
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...
1
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... ...
6
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...
4
by: yogeshjain91 | last post by:
how to find factorial of a given no.and how to find sum of odd and even no.
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...
0
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...
0
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
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...

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.