Pergunta de entrevista da empresa Roche

Q: Given a string, define an algorithm to generate all possibilities of permutation.