Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. private static ArrayList<HighScore> highScores = new ArrayList<HighScore>();
  2.  
  3. quickSort(highScores,First,Last);
  4.  
  5. private static void quickSort(ArrayList<HighScore> highScores2, int first, int last){
  6.  
  7. if(first < last)
  8. {
  9. PivotValue = highScores2.get(first).getScore();
  10. LeftPointer = first + 1;
  11. RightPointer = last;
  12.  
  13. while((LeftPointer <= RightPointer))
  14. {
  15. while((LeftPointer <= RightPointer)&&(highScores2.get(LeftPointer).getScore() < PivotValue))
  16. {
  17. LeftPointer++;
  18. }
  19. while((highScores2.get(RightPointer).getScore() > PivotValue)&&(LeftPointer <= RightPointer))
  20. {
  21. RightPointer--;
  22. }
  23. if(LeftPointer < RightPointer)
  24. {
  25. HighScore temp = highScores2.get(LeftPointer);
  26. highScores2.set(RightPointer, highScores2.get(LeftPointer));
  27. temp.equals(highScores2.get(RightPointer));
  28. }
  29. }
  30.  
  31. Pivot = RightPointer;
  32. HighScore temp = highScores2.get(first);
  33. highScores2.set(Pivot,highScores2.get(first));
  34. temp.equals(highScores2.get(Pivot));
  35.  
  36. quickSort(highScores2, first, Pivot-1);
  37. quickSort(highScores2, Pivot + 1, last);
  38. }
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement