sm2@sequent.cc.hull.ac.uk (Simon Marshall) (05/20/91)
Hi, does anybody know of an efficient algorithm to iteratively produce all numbers consisting of x digits where each digit is used at most once? ie. 58912, 01246 are valid; 58918, 01046 are not. Many thanks. Simon. _______________________________________________________________________________ Simon Marshall, Dept. of Computer Science, University of Hull, Hull HU6 7RX, UK "``La la la la la la la la la'' means I love you." EMAIL: S.Marshall@Hull.ac.uk UUCP: ..!ukc!hu-cs!sm Telephone: +44 482 465951 (office) Fax: +44 482 466666
raghu@fshvmfk1.vnet.ibm.com (05/21/91)
>From: sm2@sequent.cc.hull.ac.uk (Simon Marshall) >Message-ID: <15996.9105201547@seq.hull.ac.uk> >Date: 20 May 91 15:47:07 GMT > > Hi, does anybody know of an efficient algorithm to iteratively > produce all numbers consisting of x digits where each digit is used > at most once? ie. 58912, 01246 are valid; 58918, 01046 are not. > Many thanks. Simon. >_______________________________________________________________________________ >Simon Marshall, Dept. of Computer Science, University of Hull, Hull HU6 7RX, UK > "``La la la la la la la la la'' means I love you." > EMAIL: S.Marshall@Hull.ac.uk UUCP: ..!ukc!hu-cs!sm > Telephone: +44 482 465951 (office) Fax: +44 482 466666 A straight forward method is to generate all permutations for for each x-subset of the set {0,1,2,3,4,5,6,7,8,9}. There are efficient algorithms to generate subsets and permutations. Raghu V. Hudli IBM Corp. ==================================================================== Disclaimer: The opinions are my own and do not express the opinions of my employer