feat(Go-Tool):2021/03/26: 新增全排列的递归实现、字典序实现、递增进制位实现、递减进制位实现
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @Author : huangzj
|
||||
* @Time : 2021/3/22 11:22
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
package FullPermutation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRecursion(t *testing.T) {
|
||||
p := NewPermutation()
|
||||
|
||||
p.Recursion([]byte("123"), 0)
|
||||
fmt.Println()
|
||||
for _, bs := range p.bytes {
|
||||
fmt.Println(string(bs))
|
||||
}
|
||||
p.Reset()
|
||||
|
||||
p.Recursion([]byte("12345"), 0)
|
||||
fmt.Println()
|
||||
for _, bs := range p.bytes {
|
||||
fmt.Println(string(bs))
|
||||
}
|
||||
p.Reset()
|
||||
|
||||
p.Recursion([]byte("abcde"), 0)
|
||||
fmt.Println()
|
||||
for _, bs := range p.bytes {
|
||||
fmt.Println(string(bs))
|
||||
}
|
||||
p.Reset()
|
||||
|
||||
p.Recursion([]byte("abcdea"), 0)
|
||||
fmt.Println()
|
||||
for _, bs := range p.bytes {
|
||||
fmt.Println(string(bs))
|
||||
}
|
||||
p.Reset()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user