mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-20 07:21:02 +00:00
Add Swift language blocks to the docs.
This commit is contained in:
@@ -122,6 +122,12 @@ comments: true
|
||||
|
||||
```
|
||||
|
||||
=== "Swift"
|
||||
|
||||
```swift title="linear_search.swift"
|
||||
|
||||
```
|
||||
|
||||
再比如,我们想要在给定一个目标结点值 `target` ,返回此结点对象,也可以在链表中进行线性查找。
|
||||
|
||||
=== "Java"
|
||||
@@ -238,6 +244,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Swift"
|
||||
|
||||
```swift title="linear_search.swift"
|
||||
|
||||
```
|
||||
|
||||
## 复杂度分析
|
||||
|
||||
**时间复杂度 $O(n)$ :** 其中 $n$ 为数组或链表长度。
|
||||
|
||||
Reference in New Issue
Block a user