Stackoverflow with Quicksort Java implementation

前端 未结 9 1506
一生所求
一生所求 2020-12-06 19:25

Having some problems implementing quicksort in java. I get a stackoverflow error when I run this program and I\'m not exactly sure why. If anyone can point out the error, it

9条回答
  •  伪装坚强ぢ
    2020-12-06 19:49

    //Just implemented the tester class for this and it'll work

    public int[] sort(int[] A, int from, int to ){

    if(from1)
            sort(A,from, pivot-1);
    
        if(pivot+1

    }

    public int partition(int A[ ], int from, int to){

    while(from < to){
        int pivot=A[from];
    
        while(A[from]pivot)
            to--;
    
    
        if(from

提交回复
热议问题