Why are permutations duplicated with LexicographicPermutations? How to avoid this?
- To: mathgroup at smc.vnet.net
- Subject: [mg54628] Why are permutations duplicated with LexicographicPermutations? How to avoid this?
- From: Valentina Mikel <valentina.mikel at po.htnet.hr>
- Date: Thu, 24 Feb 2005 03:21:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
When I enter LexicographicPermutations[{a, b, 0, 0}] the result is following: {{a, b, 0, 0}, {a, b, 0, 0}, {a, 0, b, 0}, {a, 0, 0, b}, { a, 0, b, 0}, {a, 0, 0, b}, {b, a, 0, 0}, {b, a, 0, 0}, { b, 0, a, 0}, {b, 0, 0, a}, {b, 0, a, 0}, {b, 0, 0, a}, { 0, a, b, 0}, {0, a, 0, b}, {0, b, a, 0}, {0, b, 0, a}, { 0, 0, a, b}, {0, 0, b, a}, {0, a, b, 0}, {0, a, 0, b}, { 0, b, a, 0}, {0, b, 0, a}, {0, 0, a, b}, {0, 0, b, a}} Why does the result repeat duplicate cases? In my case I must perform exact functionality of LexicographicPermutations[{0,C,D,0,G,H,J,0,0,P,0,0,T,V,0,X,Y,0,0,4,0,7,8,0}]; since there are lots of duplicates I'm trying to implement this in C++ for maximum speed. Can this be avoided in Mathematica itself, and how?
- Follow-Ups:
- Re: Why are permutations duplicated with LexicographicPermutations? How to avoid this?
- From: János <janos.lobb@yale.edu>
- Re: Why are permutations duplicated with LexicographicPermutations? How to avoid this?
- From: DrBob <drbob@bigfoot.com>
- Re: Why are permutations duplicated with LexicographicPermutations? How to avoid this?
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Why are permutations duplicated with LexicographicPermutations? How to avoid this?