programacion iterativa
-
Upload
renny-centeno -
Category
Engineering
-
view
62 -
download
0
Transcript of programacion iterativa
![Page 1: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/1.jpg)
NORMAS DE LA
EXPOSICIÓNAPAGAR LOS CELULARES.
PREGUNTAS AL FINAL.
GUARDAR SILENCIO.
![Page 2: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/2.jpg)
UNIVERSIDAD DE ORIENTENÚCLEO MONAGAS
EICACURSO ESPECIAL DE GRADO
CIENCIAS DE LA COMPUTACIÓN
PROGRAMACIÓN
ITERATIVAProfesor: Jonathan Vásquez. Integrantes: Centeno, RennyFernández, Ana
EQUIPO JAVAMaturín, Abril del 2015
![Page 3: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/3.jpg)
CONTENIDO
• INTRODUCCIÓN.
• PROGRAMACIÓN.
• ITERACIÓN
• ITERACIÓN EN LA PROGRAMACIÓN.• ITERACIÓN DECLARATIVA.
• ITERACIÓN CON FUNCIONES RECURSIVAS.• DIFERENCIAS ENTRE MÉTODOS
RECURSIVOS Y MÉTODOS ITERATIVOS.
• CONCLUSIONES.
• BIBLIOGRAFÍA.
• PROGRAMAS CON BUCLES.
![Page 4: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/4.jpg)
PROGRAMACIÓNEs el proceso de diseñar,
codificar, depurar y mantener el código fuente de programas computacionales.
ITERACIÓNActo de repetir un
proceso con el objetivo de alcanzar una meta deseada, objetivo o
resultado.
![Page 5: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/5.jpg)
ITERACIÓN EN LA PROGRAMACIÓN
En programación, iteración es la repetición de un proceso dentro de un
programa de computadora.
ITERACIÓN DECLARATI
VA
CON FUNCIONE
S RECURSIV
AS
![Page 6: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/6.jpg)
ITERACIÓN DECLARATIVABUCLE
WHILEwhile (expresion) {sentencias}
i=5; while ( i > 0 ) {i --;}System.out.println("Ahora i vale 0");
BUCLE FORfor (inicialización,
expresionBooleana, incremento) {conjuntoDeSentencias;}
for (int i= 0; i <10; i++) {System.out.println("el valor de i es: " + i); }
BUCLE DO WHILEi=5;
do {i --;}while ( i > 0 )
Iteración en la programación
![Page 7: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/7.jpg)
Iteración declarativa
SENTENCIASBREAK
i=5; do{ i --; if (i == 3) break; } while ( i > 0 )
CONTINUEi=5; do{ if (i == 3) continue; i --; }while ( i > 0 )
RETURNvoid funcionEjemplo(){ int i=0; while (i < 100){
i++;} return i; }
![Page 8: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/8.jpg)
Iteración en la programaciónITERACIÓN CON
FUNCIONES RECURSIVASUna función recursiva es aquella que se
llama a sí misma para resolverse.
El proceso de llamadas recursivas siempre tiene que acabar en una llamada a la
función que se resuelve de manera directa, sin necesidad de invocar de nuevo la
función. Esto será siempre necesario, para que llegue un momento que se corten las llamadas reiterativas a la función y no se
entre en un bucle infinito de invocaciones.
EJEMPLO: FACTORIALFactorial de 4 es igual a 4 * 3 * 2 * 1
Se puede resolver como 4 * 3!
n! = n * (n-1)!
funcion factorial(n) si n=1 entonces factorial = 1 sino factorial = n * factorial(n-1)fin función
function factorial(n){ if(n==1) return 1 else return n * factorial(n-1)}
![Page 9: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/9.jpg)
DIFERENCIAS ENTRE MÉTODOS RECURSIVOS
Y MÉTODOS ITERATIVOS
Recursivos
Iterativos
Se llaman así mismos
Utilizan bucles
Ocupan memoria considerable
Requieren poco espacio de memoria
Moderadamente complejos
Fáciles de construir
Resuelve los problemas de manera
elegante
Son poco elegantes pero eficientes
![Page 10: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/10.jpg)
PROGRAMAS CON BUCLES
![Page 11: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/11.jpg)
PROGRAMAS CON BUCLES
![Page 12: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/12.jpg)
CONCLUSIONES• LA PROGRAMACIÓN OFRECE UN
MUNDO DE POSIBILIDADES.
• REPETICIONES HASTA LOGRAR UN OBJETIVO.
• DIFERENCIAS ENTRE MÉTODOS RECURSIVOS Y MÉTODOS ITERATIVOS.
![Page 13: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/13.jpg)
BIBLIOGRAFÍA•Wikipedia, Iteración, 2015 , http://es.wikipedia.org/wiki/Iteraci%C3%B3n [consultado: martes, 21 de abril del 2015, hora: 15:22]
•Wikipedia, Programacion, 2015, http://es.wikipedia.org/wiki/Programaci%C3%B3n [consultado: martes, 21 de abril del 2015, hora: 15:52]
•GONZALEZ, Victorino, Estructuras de control tipo bucle en Java,2004, http://www.desarrolloweb.com/articulos/1760.php [consultado: martes, 21 de abril del 2015, hora: 16:37]
•ALVAREZ, Miguel, Funciones recursivas. Recursividad ,2008, http://www.desarrolloweb.com/articulos/funciones-recursivas-recursividad.html [consultado: martes, 21 de abril del 2015, hora: 18:17]
•HERNANDEZ, Enrique, Programación Java,2013, http://puntocomnoesunlenguaje.blogspot.com/2013/01/ejemplo-recursividad-sumar-dos-numeros.html [consultado: martes, 21 de abril del 2015, hora: 18:27]
![Page 14: programacion iterativa](https://reader035.fdocumento.com/reader035/viewer/2022062216/55ceaae4bb61eb19138b47ec/html5/thumbnails/14.jpg)
¡MUCHAS GRACIAS POR SU ATENCIÓN!