Permutation Example Problem
Excel & Python Examples Of A Challenging Permutation Problem
This zip file contains a Python solution & an Excel solution to the permutation problem of determining how many different ways a certain number of people can stand in a line so you can see an exact number of them.
For instance, if you have 8 people in a line, how many ways can they stand so that you can see exactly 5 of them, assuming that you can't see anyone who has a taller person standing anywhere in front of them.
That turns out to be a challenging permutation problem, and problems like it frequently show up in different programming challenges. The standard permutation problem is insufficient to solve it, a more elegant approach must be used.
The Excel solution contains a table with a bottoms up solution to the problem. The python program solves it 3 ways, one replicating the bottoms up method, one with a top down recursive method, and one with a naive brute force method that quickly collapses for the larger problems.
You're Almost there! Please complete this form and click the button below to gain instant access.
We hate SPAM and promise to keep your email address safe. We will send occasional updates from FairlyNerdy.com. If you do not wish to receive these updates you may close this box, or unsubscribe at anytime
Copyright © 2016 FairlyNerdy.com