File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ class Deque {
2
+ constructor ( ) {
3
+ this . deque = [ ] ;
4
+ }
5
+
6
+ addInicio ( valor ) {
7
+ this . deque . unshift ( valor ) ;
8
+ }
9
+
10
+ addFim ( valor ) {
11
+ this . deque . push ( valor ) ;
12
+ }
13
+
14
+ removeInicio ( ) {
15
+ this . deque . shift ( ) ;
16
+ }
17
+
18
+ removeFim ( ) {
19
+ this . deque . pop ( ) ;
20
+ }
21
+
22
+ lerDoInicio ( ) {
23
+ console . log ( this . deque ) ;
24
+ }
25
+
26
+ lerDoFim ( ) {
27
+ let dequeCopia = this . deque . slice ( ) ;
28
+ console . log ( dequeCopia . reverse ( ) ) ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Com o objetivo de alcançar uma abrangência maior e encorajar novas pessoas a c
19
19
| [ Caixeiro Viajante] [ 10 ] | [ C/C++] ( /C/CaixeiroViajante.c ) | Java | Python | [ Go] ( /Go/caixeiroviajante/caixeiroviajante.go ) | Ruby | Javascript |
20
20
| [ Ciclo Hamiltoniano] [ 11 ] | [ C/C++] ( /C/CicloHamiltoniano.c ) | Java | Python | Go | Ruby | Javascript |
21
21
| [ Componentes Conexos] [ 12 ] | [ C/C++] ( /C/ComponentesConexos.c ) | Java | Python | Go | Ruby | Javascript |
22
+ | [ Deque] [ 52 ] | C/C++ | Java | Python | Go | Ruby | [ Javascript] ( /Javascript/Deque.js ) |
22
23
| [ Exponenciação] [ 13 ] | [ C/C++] ( /C/Exponenciacao.c ) | Java | [ Python] ( /Python/Exponenciacao.py ) | [ Go] ( /Go/exponenciacao/exponenciacao.go ) | [ Ruby] ( /Ruby/Exponenciacao.rb ) | Javascript |
23
24
| [ Exponenciação Recursiva] [ 14 ] | [ C/C++] ( /C/ExponenciacaoRecursiva.c ) | Java | [ Python] ( /Python/ExponenciacaoRecursiva.py ) | Go | [ Ruby] ( /Ruby/ExponenciacaoRecursiva.rb ) | Javascript |
24
25
| [ Fatorial] [ 15 ] | [ C/C++] ( /C/Fatorial.c ) | [ Java] ( /Java/Fatorial.java ) | [ Python] ( /Python/Fatorial.py ) | [ Go] ( /Go/fatorial/fatorial.go ) | [ Ruby] ( /Ruby/Fatorial.rb ) | Javascript |
@@ -121,3 +122,4 @@ Se você tem dúvida de como contribuir, dê uma olhada no arquivo [CONTRIBUTING
121
122
[ 49 ] : https://pt.wikipedia.org/wiki/Pal%C3%ADndromo
122
123
[ 50 ] : https://pt.wikipedia.org/wiki/F%C3%B3rmula_de_Leibniz_para_%CF%80
123
124
[ 51 ] : https://pt.wikipedia.org/wiki/Algoritmo_gen%C3%A9tico
125
+ [ 52 ] : https://pt.wikipedia.org/wiki/Deque_(estruturas_de_dados)
You can’t perform that action at this time.
0 commit comments