--- a/src/pkg/sort/sort.go Fri Feb 05 15:18:32 2010 -0800 +++ b/src/pkg/sort/sort.go Sun Feb 07 21:02:13 2010 -0700 @@ -12,9 +12,11 @@ type Interface interface { // Len is the number of elements in the collection. Len() int + // Less returns whether the element with index i should sort // before the element with index j. Less(i, j int) bool + // Swap swaps the elements with indexes i and j. Swap(i, j int) } @@ -184,15 +186,19 @@ // SortInts sorts an array of ints in increasing order. func SortInts(a []int) { Sort(IntArray(a)) } + // SortFloats sorts an array of floats in increasing order. func SortFloats(a []float) { Sort(FloatArray(a)) } + // SortStrings sorts an array of strings in increasing order. func SortStrings(a []string) { Sort(StringArray(a)) } // IntsAreSorted tests whether an array of ints is sorted in increasing order. func IntsAreSorted(a []int) bool { return IsSorted(IntArray(a)) } + // FloatsAreSorted tests whether an array of floats is sorted in increasing order. func FloatsAreSorted(a []float) bool { return IsSorted(FloatArray(a)) } + // StringsAreSorted tests whether an array of strings is sorted in increasing order. func StringsAreSorted(a []string) bool { return IsSorted(StringArray(a)) }