aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2012-03-20 11:40:41 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2012-03-20 11:40:41 -0700
commit65dc7dc90bece08e9810de12acf06f82cc6a6384 (patch)
tree9096c27ec1fa959e0e6a290e197ba89e7e39ab2a
parent1abd8d8fd04fd64f90d3c1cbce675ab2317ec449 (diff)
downloadgo-65dc7dc90bece08e9810de12acf06f82cc6a6384.tar.gz
go-65dc7dc90bece08e9810de12acf06f82cc6a6384.zip
sort: document two undocumented functions
They looked out of place in godoc. Includes documenting sort stability. Fixes #3356 R=golang-dev, gri, trolleriprofessorn CC=golang-dev https://golang.org/cl/5855044
-rw-r--r--src/pkg/sort/sort.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/sort/sort.go b/src/pkg/sort/sort.go
index 31da3c83d0..60f2d9ab40 100644
--- a/src/pkg/sort/sort.go
+++ b/src/pkg/sort/sort.go
@@ -183,6 +183,8 @@ func quickSort(data Interface, a, b, maxDepth int) {
}
}
+// Sort sorts data.
+// The algorithm used is not guaranteed to be a stable sort.
func Sort(data Interface) {
// Switch to heapsort if depth of 2*ceil(lg(n)) is reached.
n := data.Len()
@@ -194,6 +196,7 @@ func Sort(data Interface) {
quickSort(data, 0, n, maxDepth)
}
+// IsSorted reports whether data is sorted.
func IsSorted(data Interface) bool {
n := data.Len()
for i := n - 1; i > 0; i-- {