Blog

Go Permutations

This is a very simple implementation in Go of the Heap's algorithm to generate permutations.

To modify it simply update the main function with a new string. Each element in the collection should be separated by spaces.

The generated output will look like this:

 

foo, bar, baz
bar, foo, baz
baz, bar, foo
bar, baz, foo
baz, foo, bar
foo, baz, bar