By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,513 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,513 IT Pros & Developers. It's quick & easy.

How to print permutations?

P: n/a
If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....

May 25 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 25 Maj, 14:44, Shraddha <shraddhajosh...@gmail.comwrote:
If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....
Perhaps std::next_permutation() can be of use.

--
Erik Wikström

May 25 '07 #2

P: n/a
"Shraddha" writes:
If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....
Use std::next_permutation() in <algorithm>.
May 25 '07 #3

P: n/a
Shraddha wrote:
If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....
Are all of these questions school work or something?
May 25 '07 #4

P: n/a
On May 25, 5:50 pm, Deniz Dogan <kristn...@nospam.comwrote:
Shraddha wrote:
If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....

Are all of these questions school work or something?
Hi Deniz...
This is not a school work...
Actually these permutations are not supposed to be printed mannually.
There is a formula for that permutations....b'coz of which we can do
that program within 5-7 lines...that works not only for 3 variables
but for n number of characters.
But I am not aware of that formula...so I just want to know that
formula....

May 26 '07 #5

P: n/a
Shraddha wrote:
On May 25, 5:50 pm, Deniz Dogan <kristn...@nospam.comwrote:
>Shraddha wrote:
>>If we have three variables a,b,c...which are char variables....then
hoe to print there all permutations?
for example....abc, bac, cab.......all of them....
Are all of these questions school work or something?

Hi Deniz...
This is not a school work...
Actually these permutations are not supposed to be printed mannually.
There is a formula for that permutations....b'coz of which we can do
that program within 5-7 lines...that works not only for 3 variables
but for n number of characters.
But I am not aware of that formula...so I just want to know that
formula....
http://www.von-oppen.com/doc/cuj/htm...son/nelson.htm

It has the 'formula' you want (actually the algorithm) if you are
prepared to do a little work and actually understand.

john
May 26 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.