MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / sortSlices

Function sortSlices

graph/kosaraju_test.go:96–106  ·  view source on GitHub ↗

Utility function to sort the slices and their contents

(s [][]int)

Source from the content-addressed store, hash-verified

94
95// Utility function to sort the slices and their contents
96func sortSlices(s [][]int) {
97 for _, inner := range s {
98 sort.Ints(inner)
99 }
100 sort.Slice(s, func(i, j int) bool {
101 if len(s[i]) == 0 || len(s[j]) == 0 {
102 return len(s[i]) < len(s[j])
103 }
104 return s[i][0] < s[j][0]
105 })
106}

Callers 1

TestKosarajuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected