Combine QuickSort and Median selection algorithm

前端 未结 4 708
隐瞒了意图╮
隐瞒了意图╮ 2021-01-25 15:18

I want to modify QuickSort (in Java) so that every time Partition is called, the median of the proportioned array is used as the pivot.

I have a median selection algorit

4条回答
  •  抹茶落季
    2021-01-25 16:20

    Note that in PARTITION the pivot is A[r].

    public int QUICKSORT2(int[] A, int p, int r) {
        if (p

提交回复
热议问题