//Metodos public void quickSort(int lowerIndex, int higherIndex) {//Quicksort int init = lowerIndex; int finit = higherIndex; //calculate pivot number Song pivot = this.getValue(init + (finit - init) / 2); // while (init <= finit) { while (this.getValue(init).GetDisc() <= pivot.GetDisc()) { if (this.getValue(init).GetDisc() < pivot.GetDisc()) { init++; } else { if (this.getValue(init).getAlbumIndex() < pivot.getAlbumIndex()) { init++; } } } while (this.getValue(finit).GetDisc() >= pivot.GetDisc()) { if (this.getValue(finit).GetDisc() > pivot.GetDisc()) { finit++; } else { if (this.getValue(init).getAlbumIndex() > pivot.getAlbumIndex()) { finit++; } } } if (init <= finit) { swapSongs(init, finit); //move index to next position on both sides init++; finit--; } } // call quickSort() method recursively if (lowerIndex < finit) { quickSort(lowerIndex, finit); } if (init < higherIndex) { quickSort(init, higherIndex); } }