Permutations of numbers in columns and lines

Rodrigo Costa
Rodrigo Costa used Ask the Experts™
Hi folks I'm trying to find a way to find all the possible permutations on an array of 4x4 without allowing the repetition of lines and columns. So one would get the smallest value in a column and than the next value would not take into account the first column since there was a number chosen from there already and from the line chosen and so forth.

So let's say that you have:
        1      2      3      4
A    94     1     54    68
B    74    10    88    82
C    73    88     8     76
D     1     74    81    21

Any help in giving me a way to achieve it would be much appreciated. Cheers.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If your set of numbers is what you've shown above, you put the first number in A1, then one of the remaining numbers (excluding the number in A1) in A2 and repeat.
So it's something like 16-factorial minus a few.
You can solve it with recursion or looping.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial