3.02.2005

How I Spend My Days

I sure everyone wants to know about this... Kidding.

Today I figured out - although I'm sure someone else has done this before - the algorithm that determines how many ways a string of length n can swap x characters. For example: how many different ways can ABCDE swap exactly 3 characters, so that none of the 3 characters is in their original position. This defaults to swapping 2. Yes, its permutations, but a small variation. Plus I couldn't remember any of the calculations from back in high school, when I had a graphalator do much of this.

All this so I can then create the right number of permutations to test a program.

0 Comments:

Post a Comment

<< Home