Update quick_sort.md

Fix the Golang code for median
This commit is contained in:
dshlstarr 2023-01-15 17:17:52 +08:00 committed by GitHub
parent 33e84ff50b
commit ea3eee8b87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -483,7 +483,7 @@ comments: true
func medianThree(nums []int, left, mid, right int) int {
if (nums[left] > nums[mid]) != (nums[left] > nums[right]) {
return left
} else if (nums[mid] < nums[left]) != (nums[mid] > nums[right]) {
} else if (nums[mid] > nums[left]) != (nums[mid] > nums[right]) {
return mid
}
return right