mirror of
https://github.com/krahets/hello-algo.git
synced 2026-02-13 07:35:47 +08:00
Fix quick_sort.py
This commit is contained in:
@@ -56,7 +56,7 @@ class QuickSortMedian {
|
||||
|
||||
/* 选取三个元素的中位数 */
|
||||
static int medianThree(int[] nums, int left, int mid, int right) {
|
||||
// 使用了异或操作来简化代码
|
||||
// 此处使用异或运算来简化代码
|
||||
// 异或规则为 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1
|
||||
if ((nums[left] < nums[mid]) ^ (nums[left] < nums[right]))
|
||||
return left;
|
||||
|
||||
Reference in New Issue
Block a user