Algorithm for generating permutations was implemented