https://github.com/chanced/powerset
Generic powerset algorithm for go
https://github.com/chanced/powerset
Last synced: about 1 year ago
JSON representation
Generic powerset algorithm for go
- Host: GitHub
- URL: https://github.com/chanced/powerset
- Owner: chanced
- License: mit
- Created: 2022-04-23T15:51:41.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T16:56:19.000Z (about 4 years ago)
- Last Synced: 2024-10-06T00:42:40.438Z (over 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# powerset
Generic [powerset](https://en.wikipedia.org/wiki/Power_set) algorithm for go
## Install
```bash
go get github.com/chanced/powerset
```
## Usage
```go
package main
func main() {
fmt.Println(powerset.Compute([]string{"a", "b", "c"}))
// output: [[] [a] [b] [a b] [c] [a c] [b c] [a b c]]
fmt.Println(powerset.Compute([]int{1, 2, 3}))
// output: [[] [1] [2] [1 2] [3] [1 3] [2 3] [1 2 3]]
}
```
## Contributions
Contributions of any kind are always welcome. If there's a problem or there is a
way to improve this algorithm, please feel free to open an issue or pull
request.
## License
MIT