Fix quick_sort.py

This commit is contained in:
krahets
2023-02-21 21:51:56 +08:00
parent b89ea3eba4
commit 0b72fef381
11 changed files with 12 additions and 12 deletions

View File

@@ -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;