Documentation
¶
Overview ¶
Package permutation provides algorithms about permutations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NextPermutation ¶
NextPermutation transforms data to its next permutation in lexical order. It returns false if data.Len() == 0 or the permutations are exhausted, and true otherwise. Time complexity: O(n), where n = data.Len().
Types ¶
type ArrayAdapter ¶
ArrayAdapter is an adapter for: sequence.Array + function.LessFunc -> Interface.
func (*ArrayAdapter) Len ¶
func (ad *ArrayAdapter) Len() int
Len returns the number of items in the array.
func (*ArrayAdapter) Less ¶
func (ad *ArrayAdapter) Less(i, j int) bool
Less reports whether the item with index i must sort before the item with index j.
func (*ArrayAdapter) Swap ¶
func (ad *ArrayAdapter) Swap(i, j int)
Swap swaps the items with indexes i and j.
Click to show internal directories.
Click to hide internal directories.