permutation/README.md

35 lines
387 B
Markdown
Raw Normal View History

2022-01-21 21:12:47 +00:00
# permutation
2022-04-28 20:43:16 +00:00
A simple permutation package using generics. Requires go1.18 or higher
2022-01-21 21:12:47 +00:00
## Install
```bash
go get git.fputs.com/fputs/permutation
```
## Usage
```go
package main
import (
"fmt"
perm "git.fputs.com/fputs/permutation"
)
func main() {
2022-04-28 20:44:11 +00:00
a := []int{1, 2, 3}
2022-01-21 21:12:47 +00:00
p := perm.Permutations(a)
fmt.Println(p)
}
```
result:
```
[1 2 3]
[2 1 3]
[3 1 2]
[1 3 2]
[2 3 1]
[3 2 1]
```