Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- public class Main {
- public static void main(String[] args) throws IOException {
- long startTime = 0, endTime = 0, time = 0;
- char[] v;
- String dir;
- /* Tamanho do vetor
- * n = 1 -> vet = 10240
- * n = 2 -> vet = 102400
- * n = 3 -> vet = 512000
- * n = 4 -> vet = 1048576
- */
- int n = 1;
- dir = Helper.criarArquivo(n);
- v = Helper.lerArquivo(dir);
- System.out.println("Tamanho: " + Helper.getTamanho(n) / 1024 + " KB");
- startTime = System.currentTimeMillis();
- Order.bubbleSort(v, v.length);
- endTime = System.currentTimeMillis();
- time = endTime - startTime;
- System.out.println("Bubble, tempo gasto: " + time + " ms");
- startTime = System.currentTimeMillis();
- Order.mergeSort(v, 0, v.length - 1);
- endTime = System.currentTimeMillis();
- time = endTime - startTime;
- System.out.println("Merge, tempo gasto: " + time + " ms");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment