mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-16 03:59:18 +08:00
Fix quick_sort.py
This commit is contained in:
@@ -63,7 +63,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