MCPcopy Create free account
hub / github.com/egonelbre/exp / CodeCount

Function CodeCount

permutation/code.go:96–110  ·  view source on GitHub ↗
(perm [base]byte)

Source from the content-addressed store, hash-verified

94}
95
96func CodeCount(perm [base]byte) int {
97 r := 0
98 for min := byte(0); min < base-1; min++ {
99 z := 0
100 for _, v := range perm {
101 if v > min {
102 z++
103 } else if v == min {
104 break
105 }
106 }
107 r += z * fact[min]
108 }
109 return r
110}
111
112func CodeTable(perm [base]byte) int {
113 var index [base]byte

Callers 2

checkFunction · 0.85
BenchmarkCountFunction · 0.85

Calls

no outgoing calls

Tested by 2

checkFunction · 0.68
BenchmarkCountFunction · 0.68