Content deleted Content added
→Partition-based general selection algorithm: pivotDist should be calculated based on left bound |
|||
Line 67:
pivotIndex := ... ''// select pivotIndex between left and right''
pivotNewIndex := partition(list, left, right, pivotIndex)
pivotDist := pivotNewIndex - left + 1
'''if''' pivotDist = k
'''return''' list[pivotNewIndex]
|