Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public static void main (String[] args) {
  2. for (int i = 0; i<6; i++) {
  3. double mySortTime = 0;
  4. double defaultSortTime = 0;
  5. double[] vals = new double [(int) Math.pow(10, i)];
  6. fillVals(vals, 1, 1000000);
  7. double [] copy = copyArr(vals);
  8. long time = System.nanoTime();
  9. bubbleSort(vals);
  10. mySortTime = System.nanoTime()-time;
  11. time = 0;
  12. time = System.nanoTime();
  13. sortPar(copy);
  14. defaultSortTime = System.nanoTime()-time;
  15. mySortTime /= 1000000.00;
  16. defaultSortTime = defaultSortTime/1000000.00;
  17.  
  18. System.out.println("numVals " + Math.pow(10, i) + "\t Parmeet: " + defaultSortTime + "\t mine: " + mySortTime );
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement