I want to implement the QuickSort Algorithm on a sync Doubly Linked List. I give the function \"partition\" the left and right border, then it starts to search lower values on t
Node partition(Node start, Node end){
Node l = start;
Node h = end.previous;
Node pivot = end;
if(end!=null && end.next!=start){ //Whenever deal with end.next, check null check
while(h!=null && h.next!=l){//Whenever deal with end.next, check null check
System.out.println("gumi");
if(l.datapivot.data)
h=h.previous;
else{
int temp = l.data;
l.data = h.data;
h.data = temp;
}
}
int temp = pivot.data;
pivot.data = l.data;
l.data = temp;
}
return l;
}
void quicksort(Node start, Node end){
System.out.println("jose");
if(end!=null && end.next!=start ){ //Whenever deal with end.next, check null check , end should not be less than start: so the condition end.next!=start
System.out.println("Quixk");
Node pivot = partition(start,end);
quicksort(start, pivot.previous);
quicksort(pivot.next, end);
}
}