Advertisement
Guest User

SortTester

a guest
Jan 23rd, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1.  
  2. public class SortTester {
  3. public static void main(String[] args) {
  4. //bubble sort
  5. int[] a = ArrayUtil.randomIntArray(40,100);
  6. //System.out.println(ArrayUtil.printArray(0, a.length-1, a));
  7. BubbleSort b = new BubbleSort(a);
  8. int s = b.sort();
  9. //a = b.getArray();
  10. //System.out.println();
  11. //System.out.println(ArrayUtil.printArray(0, a.length-1, a));
  12. //System.out.println();
  13. //System.out.println("Swaps:" +s);
  14. //Selection sort
  15. a = ArrayUtil.randomIntArray(40,100);
  16. System.out.println(ArrayUtil.printArray(0, a.length-1, a));
  17. SelectionSort c = new SelectionSort(a);
  18. s = c.sort();
  19. a = c.getArray();
  20. System.out.println();
  21. System.out.println(ArrayUtil.printArray(0, a.length-1, a));
  22. System.out.println();
  23. System.out.println("Swaps:" + s);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement