Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site rabbit.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!rabbit!ark From: ark@rabbit.UUCP (Andrew Koenig) Newsgroups: net.micro.pc Subject: Re: Programing Puzzle Message-ID: <2998@rabbit.UUCP> Date: Sun, 22-Jul-84 10:48:48 EDT Article-I.D.: rabbit.2998 Posted: Sun Jul 22 10:48:48 1984 Date-Received: Mon, 23-Jul-84 02:14:42 EDT References: <145@hocsl.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 10 A beatiful solution appears in Dijkstra's "A Discipline of Programming." It is expressed as a program fragement to transform a given permutation into its successor. Thus, if applied repeatedly, the program will generate all permutations. The program is non-recursive, so it can easily be implemented in any language, and saves no state information aside from the actual permutation. Unfortunately, I don't have a copy of the book handy right now, and it's been a few years since I've seen this particular algorithm, so I don't remember it exactly. If I reconstruct it, I'll post it.