[algogeeks] Re: Arrange Matrices In Order

2006-02-07 Thread siva
This is the solutions that I am able to arrive at. This generates all the permutations in the order required. but takes quite a lot of time for 6th generation. Need to check whether this solution can be optimized more. public class P2D { boolean usedr[][]; boolean usedc[][]; //temp matrix

[algogeeks] Re: Arrange Matrices In Order

2006-02-07 Thread Karthik Singaram L
Thats the solution all right!!!

[algogeeks] Re: Arrange Matrices In Order

2006-02-06 Thread Prunthaban Kanthakumar
Sorry for the late reply. Let me post my solution (You need not know anything about Latin squares to understand this :) ) For N, let me consider a matrix where the first row and column are 1...N   1 2 3  ... N 2 3 . . N   Now we can fill the inner matrix using brute force...and find out the number

[algogeeks] Re: Arrange Matrices In Order

2006-02-01 Thread Karthik Singaram L
A clue ( The solution is obviuosly brute force, but look at the two optimizations that reduce the search space by ( n!*(n-1)! ) )-karthik

[algogeeks] Re: Arrange Matrices In Order

2006-02-01 Thread Karthik Singaram L
Hi,  I am the guy who set that question :D  Look at the huge amount of theory available on Latin Squares. In case you still are not able to get the solution just post it again and I will reply.  -karthik