17 lines
458 B
Go
17 lines
458 B
Go
package main
|
|
|
|
func (r results) Len() int { return len(r) }
|
|
func (r results) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
|
|
func (r results) Less(i, j int) bool {
|
|
if len(r[i].h) == 0 || len(r[j].h) == 0 {
|
|
return false
|
|
}
|
|
return r[i].h[0].count > r[j].h[0].count
|
|
}
|
|
|
|
func (n histogram) Len() int { return len(n) }
|
|
func (n histogram) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
|
|
func (n histogram) Less(i, j int) bool {
|
|
return n[i].count > n[j].count
|
|
}
|