Initial commit
This commit is contained in:
4
src/cl/cromer/estructuras/code/pila/peek
Normal file
4
src/cl/cromer/estructuras/code/pila/peek
Normal file
@@ -0,0 +1,4 @@
|
||||
public int peek() {
|
||||
// Devolver el valor encima
|
||||
return this.pila[encima];
|
||||
}
|
6
src/cl/cromer/estructuras/code/pila/pop
Normal file
6
src/cl/cromer/estructuras/code/pila/pop
Normal file
@@ -0,0 +1,6 @@
|
||||
public void pop() {
|
||||
// Borrar el valor que está encima.
|
||||
this.pila[encima] = 0;
|
||||
// Restar el nivel de la pila.
|
||||
encima--;
|
||||
}
|
6
src/cl/cromer/estructuras/code/pila/push
Normal file
6
src/cl/cromer/estructuras/code/pila/push
Normal file
@@ -0,0 +1,6 @@
|
||||
public void push(int valor) {
|
||||
// Sumar el nivel de la pila
|
||||
encima++;
|
||||
// Insertar el valor
|
||||
this.pila[encima] = valor;
|
||||
}
|
Reference in New Issue
Block a user