Merge pull request #259 from dshlstarr/patch-1

fix the Golang code for median in quick_sort.md
pull/261/head
Yudong Jin 2 years ago committed by GitHub
commit 6064e3b708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save