Permutation with conditions.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2006
Posts: 2
Reputation: osva is an unknown quantity at this point 
Solved Threads: 0
osva osva is offline Offline
Newbie Poster

Permutation with conditions.

 
0
  #1
Dec 9th, 2007
Is there any way to do a permutation program with conditions.. like enter "n" girls and "m" boys can stand in a line but without two girls standind together or something like that... is there any algorithm to do this..
Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2,462
Reputation: zandiago is on a distinguished road 
Solved Threads: 25
Featured Poster
zandiago's Avatar
zandiago zandiago is offline Offline
Nearly a Posting Maven

Re: Permutation with conditions.

 
0
  #2
Dec 9th, 2007
Could you please be more detailed and tell what the requirements of the program are?
I shot the sheriff....but I didn't shoot the deputy
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 2
Reputation: osva is an unknown quantity at this point 
Solved Threads: 0
osva osva is offline Offline
Newbie Poster

Re: Permutation with conditions.

 
0
  #3
Dec 9th, 2007
Ok the program required to enter n numbers of distinct girls and m number of distinct boys. Then it produce a list of every possible way the boys and girls can be on a line if two girls can stand on the line together..
Example
m = 1 (number of boys)
n = 2 (number of girls)

all accepted permutations will be

N1, M1, N2
N2, M1, N1

it cant accept

M1, N1, N2
M1, N2, N1
N1, N2, M1
N2, N1, M1
Because two 'girls' are together
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC