I need a little help with algorithm for my code.Given a word "abacus" i have the code to find all its anagrams but i need to include also the words that are smaller in length than the original word. That is, I wanna be able to list ABA,AAB,ACA....ABAC,ABCS....so on.
Thanking you in advance.
IndianaRonaldo
-3
Light Poster
Recommended Answers
Jump to PostDig out the old statistics book and look up how to calculate the number of permutations and combinations. There are several ways to approach it. Beware of duplicates. C++ make life much easier because it'll test for it. Look at STL. There are quite a few containers in it that …
Jump to PostTake the "word" ACBACBCAC (I'm using this "word" rather than a real one since it makes my point easier).
Alphabetize the letters...
AAABBCCCC
3 A's, 2 B's, 4 C's.
A "subset" is any number of A's (0 to 3 inclusive), any number of B's(0 to 2 …
All 7 Replies
VernonDozier
2,218
Posting Expert
Featured Poster
IndianaRonaldo
-3
Light Poster
theguitarist
0
Junior Poster in Training
alwaysLearning0
39
Junior Poster
VernonDozier
2,218
Posting Expert
Featured Poster
IndianaRonaldo
-3
Light Poster
IndianaRonaldo
-3
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.