Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!sam From: sam@cs.ed.ac.uk (S Manoharan) Newsgroups: comp.lang.c Subject: ** Some Help Please ** Message-ID: <12007@skye.cs.ed.ac.uk> Date: 5 Jun 91 09:43:08 GMT Sender: nnews@cs.ed.ac.uk Reply-To: sam@lfcs.ed.ac.uk (S Manoharan) Lines: 26 There is a wee problem I want to solve. There are `m' mailboxes (named 0 to m-1) which get `n' mails (named 0 to n-1) over a period of time. I want to generate all the possible ways of these mails arriving at the mailboxes. There should be factorial(n) * pow(m, n) possibilities. For instance, if m = 2 and n = 2 then the possibilities would be [m0: 0, 1; m1: -] [m0: -; m1: 0, 1] [m0: 0; m1: 1] [m0: 1, 0; m1: -] [m0: -; m1: 1, 0] [m0: 1; m1: 0] All I want is to print these possibilites for any given values (small, say, <= 10) of `m' and `n'. Can anyone help me to get hold of a C code or an algorithm to tackle this. It seems to beat me. Thanks in advance. Ps - Sorry, if I am posting this to a wrong newsgroup. -- S Manoharan Bitnet : sam%lfcs.ed.ac.uk@ukacrl.bitnet Dept of Computer Science Uucp : sam%lfcs.ed.ac.uk@ukc.uucp University of Edinburgh Fax : +44 31 667 7209 Edinburgh EH9 3JZ UK. Voice : +44 31 650 5115 (Office)