summaryrefslogtreecommitdiff
path: root/src/sort
diff options
context:
space:
mode:
Diffstat (limited to 'src/sort')
-rw-r--r--src/sort/search.go4
-rw-r--r--src/sort/search_test.go1
-rw-r--r--src/sort/sort.go1
3 files changed, 0 insertions, 6 deletions
diff --git a/src/sort/search.go b/src/sort/search.go
index fcff0f9491..601557a94b 100644
--- a/src/sort/search.go
+++ b/src/sort/search.go
@@ -55,7 +55,6 @@ package sort
// })
// fmt.Printf("Your number is %d.\n", answer)
// }
-//
func Search(n int, f func(int) bool) int {
// Define f(-1) == false and f(n) == true.
// Invariant: f(i-1) == false, f(j) == true.
@@ -79,7 +78,6 @@ func Search(n int, f func(int) bool) int {
// as specified by Search. The return value is the index to insert x if x is
// not present (it could be len(a)).
// The slice must be sorted in ascending order.
-//
func SearchInts(a []int, x int) int {
return Search(len(a), func(i int) bool { return a[i] >= x })
}
@@ -88,7 +86,6 @@ func SearchInts(a []int, x int) int {
// as specified by Search. The return value is the index to insert x if x is not
// present (it could be len(a)).
// The slice must be sorted in ascending order.
-//
func SearchFloat64s(a []float64, x float64) int {
return Search(len(a), func(i int) bool { return a[i] >= x })
}
@@ -97,7 +94,6 @@ func SearchFloat64s(a []float64, x float64) int {
// as specified by Search. The return value is the index to insert x if x is not
// present (it could be len(a)).
// The slice must be sorted in ascending order.
-//
func SearchStrings(a []string, x string) int {
return Search(len(a), func(i int) bool { return a[i] >= x })
}
diff --git a/src/sort/search_test.go b/src/sort/search_test.go
index ded68ebde0..f06897ee21 100644
--- a/src/sort/search_test.go
+++ b/src/sort/search_test.go
@@ -59,7 +59,6 @@ func TestSearch(t *testing.T) {
// log2 computes the binary logarithm of x, rounded up to the next integer.
// (log2(0) == 0, log2(1) == 0, log2(2) == 1, log2(3) == 2, etc.)
-//
func log2(x int) int {
n := 0
for p := 1; p < x; p += p {
diff --git a/src/sort/sort.go b/src/sort/sort.go
index 2c197afc03..aed0eaba30 100644
--- a/src/sort/sort.go
+++ b/src/sort/sort.go
@@ -111,7 +111,6 @@ func (x Float64Slice) Len() int { return len(x) }
// This implementation of Less places NaN values before any others, by using:
//
// x[i] < x[j] || (math.IsNaN(x[i]) && !math.IsNaN(x[j]))
-//
func (x Float64Slice) Less(i, j int) bool { return x[i] < x[j] || (isNaN(x[i]) && !isNaN(x[j])) }
func (x Float64Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }