permutation/README.md

35 lines
388 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
2022-06-02 21:01:45 +00:00
go get github.com/fputs/permutation@latest
2022-01-21 21:12:47 +00:00
```
## Usage
```go
package main
import (
"fmt"
2022-06-02 21:01:45 +00:00
perm "github.com/fputs/permutation"
2022-01-21 21:12:47 +00:00
)
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]
```