This commit is contained in:
krahets
2024-04-13 21:17:44 +08:00
parent 9332a91e26
commit 6afa70e7bc
55 changed files with 334 additions and 182 deletions
+3 -1
View File
@@ -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
}
/* 哨兵划分 */