partition
- corsort.partition(xs, i, j, lt)[source]
Move the pivot element to the right place and return its position (for quicksort or quickselect).
- Parameters:
- Returns:
Pivot index.
- Return type:
Examples
>>> my_xs = np.array([4, 1, 7, 6, 0, 8, 2, 3, 5]) >>> partition(my_xs, i=0, j=len(my_xs) - 1, lt=lambda x, y: x < y) 4 >>> my_xs array([1, 0, 2, 3, 4, 7, 6, 8, 5])