Permutations of numbers in columns and lines

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.
Rodrigo CostaLecturerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.