Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/dbyio/heappermutations

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dbyio/heappermutations

  • v1.1.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

The heappermutations package provides a Golang implementation of B. R. Heap's algorithm to generate all possible permutations of typed-datasets.

Based on https://en.wikipedia.org/wiki/Heap's_algorithm

Available functions

func Permute[T any]([]T) [][]T

Permute returns all permutations of a typed slice.

Usage

import ( "github.com/dbyio/heappermutations" )

sInts := []int{1, 2, 3}
pInts := heappermutations.Permute(sInts)		// [[1 2 3] [2 1 3] [3 1 2] [1 3 2] [2 3 1] [3 2 1]]

sStrings := []string{"a", "b", "c"}
pStrings := heappermutations.Permute(sStrings)	// [[a b c] [b a c] [c a b] [a c b] [b c a] [c b a]]

FAQs

Package last updated on 01 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc