permutations and linkedlists