mirror of
https://github.com/krahets/hello-algo.git
synced 2025-02-03 07:01:55 +08:00
Update quick_sort.md
Fix the Golang code for median
This commit is contained in:
parent
33e84ff50b
commit
ea3eee8b87
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user