Checking Permutations With A Algorithm