Public feed #381680

Something

public text v1 · immutable
Raw Edit
·published 2007-03-05 00:29 UTC
rendered paste body
if(right - left <= 1){//if left and right are right beside eachother, bypass all the swaps
 
if( (Books[m]-> getISBN() ) < (Books[left]-> getISBN()) ) swap(Books, left, m);
if( (Books[right]-> getISBN() ) < (Books[left]-> getISBN()) ) swap(Books, left, right);
if( (Books[right]-> getISBN()) < (Books[m]-> getISBN()) ) swap(Books, m, right);
swap(Books, m,  right-1);
 returnValue = (Books[right - 1]-> getISBN()); 
}else returnValue = (Books[right] -> getISBN());//just return the right most element
 
return returnValue;