-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
34 lines (30 loc) · 1.31 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
public class Main {
public static void mostrarVetor(int[] vetor) {
for (int i = 0; i < vetor.length; i++) {
System.out.print(vetor[i] + ", ");
}
}
public static void main(String[] args) {
int[] vetor = {3, 6, 8, 1, 4, 9, 0};
int[] result = {};
// Monstrando o vetor original
// Showing the original vector
System.out.println("----- Vetor não ordenado -----");
System.out.println("----- Non-ordered vector -----");
mostrarVetor(vetor);
// Mostrando o vetor ordenado pela classe Selectionsort
// Showing the vector sorted by the Selectionsort algorithm
Selectionsort alg1 = new Selectionsort();
result = alg1.ordenar(vetor);
Systen.out.println("\n\n----- Vector sorted by Selectionsort -----");
System.out.println("\n\n----- Vetor ordenado pelo Selectionsort -----");
mostrarVetor(result);
// Mostrando o vetor ordenado pela class Bubblesort
// Showing the vector sorted by the Bubblesort class
Bubblesort alg2 = new Bubblesort();
result = alg2.ordenar(vetor);
System.out.println("\n\n----- Vector sorted by Bubblesort -----");
System.out.println("\n\n----- Vetor ordenado pelo Bubblesort ------");
mostrarVetor(result);
}
}