BubbleSort and permutations