From de323c57da64c6c1de75b5701102e5b8382f4811 Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:33:24 -0500 Subject: [PATCH 1/6] Agregar configuracion de colas --- config.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.json b/config.json index 93b9d01..20b2bf9 100644 --- a/config.json +++ b/config.json @@ -156,6 +156,15 @@ "Java" ] }, + { + "name": "Queue", + "description": "Una colecciónn de elementos que son insertados y removidos siguiendo el comportamiento FIFO (Primero entrar, primero en salir)", + "filename": "queue", + "languages": [ + "C++", + "Java" + ] + }, { "name": "Métodos/Funciones", "description": "Declaración de métodos con parámetros", From d9c9ef49461c54fbb6a215935ed6ebc39311862e Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:34:58 -0500 Subject: [PATCH 2/6] Create queue --- langs/C++/queue | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 langs/C++/queue diff --git a/langs/C++/queue b/langs/C++/queue new file mode 100644 index 0000000..adb08ea --- /dev/null +++ b/langs/C++/queue @@ -0,0 +1,5 @@ +queue q; +q.push(15); //Insertar +q.pop(); //Remover elemento del frente de la cola +q.front(); //Obtener el elemento superior sin removerlo +q.empty(); //Verificar si la cola esta vacia From d94d75c15500b9a8f181e1cd94137aef85aefb88 Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:37:16 -0500 Subject: [PATCH 3/6] Create queue --- langs/Java/queue | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 langs/Java/queue diff --git a/langs/Java/queue b/langs/Java/queue new file mode 100644 index 0000000..4c13cce --- /dev/null +++ b/langs/Java/queue @@ -0,0 +1,5 @@ +Queue q = new LinkedList(); +q.add(15); //Insertar +q.poll(); //Obtener y remover el elemento del frente +q.peek(); //Obtener el elemento del frente sin removerlo +q.isEmpty(); //Verificar si la cola esta vacia From 56ebfbd8d25f4e7774498f6e2859584d7d798344 Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:43:15 -0500 Subject: [PATCH 4/6] Update config.json --- config.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index 20b2bf9..b972d54 100644 --- a/config.json +++ b/config.json @@ -157,7 +157,7 @@ ] }, { - "name": "Queue", + "name": "Cola", "description": "Una colecciónn de elementos que son insertados y removidos siguiendo el comportamiento FIFO (Primero entrar, primero en salir)", "filename": "queue", "languages": [ @@ -165,6 +165,15 @@ "Java" ] }, + { + "name": "Pila", + "description": "Una colección de elementos que son insertados y removidos acorde al comportamiento LIFO (último en entrar primero en salir)", + "filename": "stack", + "languages": [ + "C++", + "Java" + ] + }, { "name": "Métodos/Funciones", "description": "Declaración de métodos con parámetros", From 00acc3a8fded8e98516a5dd3e7d36f4c2cbde37a Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:45:31 -0500 Subject: [PATCH 5/6] Create stack --- langs/Java/stack | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 langs/Java/stack diff --git a/langs/Java/stack b/langs/Java/stack new file mode 100644 index 0000000..9c51309 --- /dev/null +++ b/langs/Java/stack @@ -0,0 +1,5 @@ +Stack s = new Stack(); +s.push(15); //Inserta un elemento al tope de la pila +s.peek(); //Obtiene el elemento del tope de la pila +s.pop(); //Obtiene y remueve el elemento del tope de la pila +s.empty(); //Verifica si la pila esta vacia From 2755fb3f79950a2a55ebf16963705f1c782ca03f Mon Sep 17 00:00:00 2001 From: Oscar Gelvez Date: Tue, 31 Oct 2017 07:47:13 -0500 Subject: [PATCH 6/6] Create stack --- langs/C++/stack | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 langs/C++/stack diff --git a/langs/C++/stack b/langs/C++/stack new file mode 100644 index 0000000..3164b4d --- /dev/null +++ b/langs/C++/stack @@ -0,0 +1,5 @@ +stack s; +s.push(15); //Inserta en el tope de la pila +s.top(); //Obtiene el elemento del tope de la pila +s.pop(); //Remueve el elemento del tope de la pila +s.empty(); //Verifica si la pila esta vacia