Skip to content

Commit a9fe3b0

Browse files
authored
Merge pull request #369 from kelvins/kelvins-patch-2
Update super-linter to 8.5.0
2 parents 8dbfd05 + 93f1a31 commit a9fe3b0

35 files changed

Lines changed: 140 additions & 54 deletions

.github/linters/.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
linters:
1+
version: "2"
2+
formatters:
23
enable:
34
- gofmt
45
- goimports

.github/workflows/lint-checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
with:
1616
fetch-depth: 0
1717
- name: Check Code
18-
uses: super-linter/super-linter@v7.1.0
18+
uses: super-linter/super-linter@v8.5.0
1919
env:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2121
VALIDATE_GO: true

src/c/CircularLinkedList.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ bool excluir(TIPOCHAVE ch, LISTA *L) {
5151
// como endereço de memória, assim a função busca
5252
// altera ele, guardando o valor anterior
5353
if (aux == NULL)
54-
return false; // Não encontrou
55-
ant->prox = aux->prox; // Nó anterior aponta para o próximo, no caso o próximo
56-
// que o nó a ser excluído está apontando
57-
free(aux); // Libera a memória
54+
return false;
55+
ant->prox = aux->prox;
56+
free(aux);
5857
return true;
5958
}
6059

@@ -67,10 +66,10 @@ void inserir(TIPOCHAVE ch, LISTA *L) {
6766
pos = pos->prox; // Vai para o próximo nó
6867
}
6968
// Quando encontrou a posição correta na ordem crescente
70-
PONT novo_no = (PONT)malloc(sizeof(NO)); // Cria um novo nó
71-
novo_no->chave = ch; // Coloca a chave no nó
72-
novo_no->prox = pos; // Aponta para o próximo nó
73-
ant->prox = novo_no; // Nó anterior aponta para o novo nó
69+
PONT novo_no = (PONT)malloc(sizeof(NO));
70+
novo_no->chave = ch;
71+
novo_no->prox = pos;
72+
ant->prox = novo_no;
7473
}
7574

7675
PONT mostrarLista(LISTA L) {
@@ -111,4 +110,4 @@ int main() {
111110
printf("Valor %d não encontrado.\n", valor);
112111

113112
return 0;
114-
}
113+
}

src/c/LinearSearchSentinel.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ int buscaSentinela(int vetor[], int chave) {
1919
while (vetor[aux] !=
2020
chave) // Enquanto não encontrar o valor (chave) incrementa 1 em aux
2121
aux++;
22-
if (aux == TAM_VETOR) // Caso o valor de aux seja igual ao tamanho do vetor,
23-
// significa que foi até o final e não encontrou o valor
24-
return -1; // Não encontrou
25-
else // Caso aux seja diferente, significa que encontrou o valor e quebrou o
26-
// laço, o aux é a posição do valor buscado
27-
return aux; // Encontrou
22+
if (aux == TAM_VETOR)
23+
return -1;
24+
return aux;
2825
}
2926

3027
int main() {

src/javascript/BinarySearchTree.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,27 @@ class BinarySearchTree {
170170
}
171171
}
172172

173+
function main() {
174+
let tree = new BinarySearchTree();
175+
176+
tree.add(1);
177+
tree.add(4);
178+
tree.add(3);
179+
tree.add(5);
180+
tree.add(2);
181+
182+
tree.preOrderTraversal();
183+
tree.inOrderTraversal();
184+
tree.postOrderTraversal();
185+
186+
tree.containsElement(3);
187+
tree.remove(3);
188+
tree.containsElement(3);
189+
tree.inOrderTraversal();
190+
191+
tree.empty();
192+
tree.inOrderTraversal();
193+
}
194+
195+
main();
196+

src/javascript/Deque.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,23 @@ class Deque {
2727
let dequeCopy = this.deque.slice();
2828
console.log(dequeCopy.reverse());
2929
}
30-
}
30+
}
31+
32+
function main() {
33+
let deque = new Deque();
34+
35+
deque.addFront(2);
36+
deque.addFront(1);
37+
deque.addFront(0);
38+
39+
deque.addEnd(3);
40+
deque.addEnd(4);
41+
42+
deque.removeFront();
43+
deque.removeEnd();
44+
45+
deque.readFromFront();
46+
deque.readFromEnd();
47+
}
48+
49+
main();

src/javascript/DoublyLinkedList.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,17 @@ class DoublyLinkedList {
103103
}
104104
}
105105
}
106+
107+
function main() {
108+
let list = new DoublyLinkedList();
109+
110+
list.addToFront(2);
111+
list.addToFront(1);
112+
list.addToEnd(3);
113+
114+
list.readFromFront();
115+
list.remove(2);
116+
list.readFromEnd();
117+
}
118+
119+
main();

src/javascript/LinearSearchSentinel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ function sentinelSearch(array, wantedValue) {
1616
}
1717

1818
function main() {
19-
array = [32, 45, 31, 87, 32, 12, 76, 32, 16, 47, 54, 90];
20-
wantedValue = 54;
19+
let array = [32, 45, 31, 87, 32, 12, 76, 32, 16, 47, 54, 90];
20+
const wantedValue = 54;
2121

22-
foundIndex = sentinelSearch(array, wantedValue);
22+
const foundIndex = sentinelSearch(array, wantedValue);
2323

2424
if (foundIndex >= 0) {
2525
console.log(`Value found at index "${foundIndex}".`)

src/javascript/MinMaxIterative.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ const MAX_LENGTH = 10;
44
* @param {number[]} vector
55
*/
66
function MinMaxIterative(vector){
7-
let min = max = vector[0];
7+
let min = vector[0];
8+
let max = vector[0];
89

910
vector.forEach(value => {
1011
if (value > max) max = value;
1112
if(value < min) min = value;
1213
});
1314

14-
return {
15-
min,
16-
max
17-
}
15+
return {min, max}
1816
}
1917

2018
function main(){
@@ -32,4 +30,4 @@ function main(){
3230
console.log(`Min: ${result.min}\nMax: ${result.max}`);
3331
}
3432

35-
main();
33+
main();

src/javascript/Queue.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,21 @@ class Queue {
1818
empty() {
1919
this.queue = [];
2020
}
21-
}
21+
}
22+
23+
function main() {
24+
let queue = new Queue();
25+
26+
queue.enqueue(1);
27+
queue.enqueue(2);
28+
queue.enqueue(3);
29+
queue.read();
30+
31+
queue.dequeue();
32+
queue.read();
33+
34+
queue.empty();
35+
queue.read();
36+
}
37+
38+
main();

0 commit comments

Comments
 (0)