User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Programming question Page [1]  
1985
All American
2175 Posts
user info
edit post

I'm trying to do this in matlab, but if you can do it in any language, that'd be great.

I need to know how to find all permutations of a set, count the number of transpositions it took to get that particular permutation, and list each pair of permuted elements. . . ie. for the permutation (x3,x2,x1) of (x1,x2,x3), i need 3 transpositions (x1 switches with x2), (x1 switches with x3) and (x3 switches with x2) and the pairs would then be x1x2, x1x3 and x2x3...

If anyone could help me come up with some algorithm, that'd be great.

1/8/2007 12:19:41 PM

nonlogic
All American
1252 Posts
user info
edit post

perms([1;2;3]) for your example

1/8/2007 1:09:21 PM

1985
All American
2175 Posts
user info
edit post

^ Thanks. Is there a way to find the sign of the permutation?

1/8/2007 2:22:38 PM

 Message Boards » Study Hall » Programming question Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.