|
|
@ -194,61 +194,61 @@ $$
|
|
|
|
=== "Java"
|
|
|
|
=== "Java"
|
|
|
|
|
|
|
|
|
|
|
|
```java title="binary_search.java"
|
|
|
|
```java title="binary_search.java"
|
|
|
|
[class]{binary_search}-[func]{binarySearch1}
|
|
|
|
[class]{binary_search}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "C++"
|
|
|
|
=== "C++"
|
|
|
|
|
|
|
|
|
|
|
|
```cpp title="binary_search.cpp"
|
|
|
|
```cpp title="binary_search.cpp"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "Python"
|
|
|
|
=== "Python"
|
|
|
|
|
|
|
|
|
|
|
|
```python title="binary_search.py"
|
|
|
|
```python title="binary_search.py"
|
|
|
|
[class]{}-[func]{binary_search1}
|
|
|
|
[class]{}-[func]{binary_search_lcro}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "Go"
|
|
|
|
=== "Go"
|
|
|
|
|
|
|
|
|
|
|
|
```go title="binary_search.go"
|
|
|
|
```go title="binary_search.go"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "JavaScript"
|
|
|
|
=== "JavaScript"
|
|
|
|
|
|
|
|
|
|
|
|
```javascript title="binary_search.js"
|
|
|
|
```javascript title="binary_search.js"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "TypeScript"
|
|
|
|
=== "TypeScript"
|
|
|
|
|
|
|
|
|
|
|
|
```typescript title="binary_search.ts"
|
|
|
|
```typescript title="binary_search.ts"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "C"
|
|
|
|
=== "C"
|
|
|
|
|
|
|
|
|
|
|
|
```c title="binary_search.c"
|
|
|
|
```c title="binary_search.c"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "C#"
|
|
|
|
=== "C#"
|
|
|
|
|
|
|
|
|
|
|
|
```csharp title="binary_search.cs"
|
|
|
|
```csharp title="binary_search.cs"
|
|
|
|
[class]{binary_search}-[func]{binarySearch1}
|
|
|
|
[class]{binary_search}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "Swift"
|
|
|
|
=== "Swift"
|
|
|
|
|
|
|
|
|
|
|
|
```swift title="binary_search.swift"
|
|
|
|
```swift title="binary_search.swift"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
=== "Zig"
|
|
|
|
=== "Zig"
|
|
|
|
|
|
|
|
|
|
|
|
```zig title="binary_search.zig"
|
|
|
|
```zig title="binary_search.zig"
|
|
|
|
[class]{}-[func]{binarySearch1}
|
|
|
|
[class]{}-[func]{binarySearchLCRO}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
对比这两种代码写法,我们可以发现以下不同点:
|
|
|
|
对比这两种代码写法,我们可以发现以下不同点:
|
|
|
|