void quickSort_ascending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)<x) i++; while (intAt(j)>x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_ascending(lo, j); if (i<hi) quickSort_ascending(i, hi); }
void quickSort_descending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)>x) i++; while (intAt(j)<x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_descending(lo, j); if (i<hi) quickSort_descending(i, hi); } }
void quickSort_descending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)>x) i++; while (intAt(j)<x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_descending(lo, j); if (i<hi) quickSort_descending(i, hi); } }
void quickSort_ascending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)<x) i++; while (intAt(j)>x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_ascending(lo, j); if (i<hi) quickSort_ascending(i, hi); }
void quickSort_ascending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)<x) i++; while (intAt(j)>x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_ascending(lo, j); if (i<hi) quickSort_ascending(i, hi); }
void quickSort_descending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)>x) i++; while (intAt(j)<x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_descending(lo, j); if (i<hi) quickSort_descending(i, hi); } }
fib.modifyEntry(i,fib.intAt(i+count));
fib.modifyEntry(i,fib.intAt(i+count));
fib.modifyEntry(i,fib.intAt(i+count));