Skip to content

Commit 8a06081

Browse files
author
Luka
committed
Translate Portuguese to English in InsertionSort.java (resolves #182)
1 parent a8db3ce commit 8a06081

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/java/InsertionSort.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ public class InsertionSort {
22

33
public static void main(String[] args) {
44

5-
int vetor[] = {9, 0, 4, 2, 3, 8, 7, 1, 6, 5};
5+
int[] array = {9, 0, 4, 2, 3, 8, 7, 1, 6, 5};
66

77
System.out.println("Insertion Sort:");
8-
System.out.println("Vetor não ordenado:");
9-
mostraVetor(vetor);
8+
System.out.println("Unsorted array:");
9+
printArray(array);
1010

11-
vetor = insertionSort(vetor);
11+
array = insertionSort(array);
1212

13-
System.out.println("Vetor ordenado:");
14-
mostraVetor(vetor);
13+
System.out.println("Sorted array:");
14+
printArray(array);
1515
}
1616

17-
public static int[] insertionSort(int vetor[]) {
18-
int chave, aux;
19-
for (int i = 0; i < vetor.length; i++) {
20-
chave = vetor[i];
17+
public static int[] insertionSort(int[] array) {
18+
int key, aux;
19+
for (int i = 0; i < array.length; i++) {
20+
key = array[i];
2121
aux = i - 1;
22-
while (aux >= 0 && vetor[aux] > chave) {
23-
vetor[aux + 1] = vetor[aux];
22+
while (aux >= 0 && array[aux] > key) {
23+
array[aux + 1] = array[aux];
2424
aux -= 1;
2525
}
26-
vetor[aux + 1] = chave;
26+
array[aux + 1] = key;
2727
}
28-
return vetor;
28+
return array;
2929
}
3030

31-
public static void mostraVetor(int vetor[]) {
32-
for (int i = 0; i < vetor.length; i++) {
33-
System.out.print(vetor[i] + ", ");
31+
public static void printArray(int[] array) {
32+
for (int i = 0; i < array.length; i++) {
33+
System.out.print(array[i] + ", ");
3434
}
3535
System.out.println("");
3636
}

0 commit comments

Comments
 (0)