I'm working on this program for a new professor and he wants us to write out what are program is going to do before we work on it. So, I've been thinking about the program and I think I'm making it more complicated.

Basically, I'm going to be given permutations of A, B, C, D, and E. From that, I'm suppose to derive what the median ranking is by seeing how many changes there are and picking the one that has the smallest amount of differences from the ones given.

From his example, you're given ABDCE, BACDE, ABCED, and ACBDE. From those, your program should generate median ranking candidates and figure out which are closest. He concluded that the ranking ABCDE was the median cause the total changes from each was only 4 where as others had more changes.

Okay, sounds easy. Well, there are 120 different permutations of ABCDE and listing them all out, comparing to however many rankings he gives us, and doing it letter by letter is going to take a while, I believe. So, I've been trying to figure out a way to limit the permutations down to only a select few.

Is this the correct way to handle this, or am I making more work for myself?

I've considered limiting it by figuring out which columns hold certain letters (ie, if there isn't an A in the last column, ignore all candidates with A in the last column) and doing so by getting an average of the rankings and swapping the letters in that to generate a few new combinations. Is there an easier way to handle this or should I just stick with one of these and see how it turns out?