hi. i want to print all the possible combinations of a string entered. for example:- string input is "abc"... then output is "abc bac acb bca cba cab" and it must be true for every length of string.. i have tried many times and applied as much logics i can. but i m not getting. just tell me starting that how to proceed. i am not asking for code here, even i don't want. i will implement own my own. please help!!
gourav1
-12
Posting Whiz in Training
Recommended Answers
Jump to Postassume the string is abcde
first group "abc" and "de" separately
"abc" is the fixed part and "de" is the variable part.
keeping "abc" fixed, there are two possibilities with which you can arrange "de"Iteration 1
abc|de --- (1)
abc|ed --- (2)In the next iteration, …
Jump to PostTry Googling for permutations so you can learn the basic algorithms.
All 5 Replies
subith86
17
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
gourav1
-12
Posting Whiz in Training
Adak
419
Nearly a Posting Virtuoso
subith86
17
Junior 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.