mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-14 01:32:27 +08:00
doc: format document
This commit is contained in:
@@ -85,7 +85,7 @@ func main() {
|
|||||||
fmt.Println(numbers)
|
fmt.Println(numbers)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ func main() {
|
|||||||
fmt.Println(numbers)
|
fmt.Println(numbers)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ func main() {
|
|||||||
fmt.Println(numbers)
|
fmt.Println(numbers)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ func main() {
|
|||||||
fmt.Println(numbers)
|
fmt.Println(numbers)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ func main() {
|
|||||||
fmt.Println(numbers)
|
fmt.Println(numbers)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ func main() {
|
|||||||
fmt.Println(sortedNums)
|
fmt.Println(sortedNums)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// [1 2 3 4 5 6]
|
// [1 2 3 4 5 6]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -478,17 +478,17 @@ func (c *intComparator) Compare(v1 any, v2 any) int {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
numbers := []int{1, 2, 3, 4, 5, 6, 7, 8}
|
numbers := []int{1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
comparator := &intComparator{}
|
comparator := &intComparator{}
|
||||||
|
|
||||||
result1 := algorithm.BinarySearch(numbers, 5, 0, len(numbers)-1, comparator)
|
result1 := algorithm.BinarySearch(numbers, 5, 0, len(numbers)-1, comparator)
|
||||||
result2 := algorithm.BinarySearch(numbers, 9, 0, len(numbers)-1, comparator)
|
result2 := algorithm.BinarySearch(numbers, 9, 0, len(numbers)-1, comparator)
|
||||||
|
|
||||||
fmt.Println(result1)
|
fmt.Println(result1)
|
||||||
fmt.Println(result2)
|
fmt.Println(result2)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// 4
|
// 4
|
||||||
// -1
|
// -1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user