Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import edu.princeton.cs.algs4.*;
  2.  
  3. public class Sorting1{
  4.  
  5.   public static void main(String[] args) {
  6.  
  7.     int N = Integer.parseInt(args[0]);
  8.  
  9.     //Býr til raðað fylki
  10.     Integer []a1 = new Integer[N];
  11.     for (int i = 0;i<N ;i++ ) {
  12.       a1[i] = i;
  13.     }
  14.  
  15.     //sort hlutinn
  16.     BlackBoxSort sorted1 = new BlackBoxSort();
  17.  
  18.     Stopwatch stop1 = new Stopwatch();
  19.     sorted1.sort6(a1);
  20.     double timi1 = stop1.elapsedTime();
  21.  
  22.  
  23.     //prenta þetta drasl út
  24.     StdOut.println("N = " + N);
  25.     StdOut.println("Tíminn er: " + timi1);
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement