mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-07 21:24:18 +00:00
build
This commit is contained in:
@@ -328,7 +328,9 @@ comments: true
|
||||
```kotlin title="quick_sort.kt"
|
||||
/* 元素交换 */
|
||||
fun swap(nums: IntArray, i: Int, j: Int) {
|
||||
nums[i] = nums[j].also { nums[j] = nums[i] }
|
||||
val temp = nums[i]
|
||||
nums[i] = nums[j]
|
||||
nums[j] = temp
|
||||
}
|
||||
|
||||
/* 哨兵划分 */
|
||||
|
||||
Reference in New Issue
Block a user