Public feed #381679

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-03-05 00:28 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);

}else return (Books[right] -> getISBN());//just return the right most element

return (Books[right - 1]-> getISBN());