Selection algorithm: Difference between revisions

Content deleted Content added
m Selection by sorting: a parenthetical reference to radix sort
Line 104:
subRight = subLeft + 4
if (subRight > right) subRight = right
medianIdx = selectIdx(list, subLeft, subRight, (subRight - subLeft) / 2) '''//alternatively, use a faster method that works on lists of size 5'''
medianIdx = selectIdx(list, subLeft, subRight, (subRight - subLeft) / 2)
'''//move the median to a contiguous block at the beginning of the list'''
swap list[left+i] and list[medianIdx]