Académique Documents
Professionnel Documents
Culture Documents
Objetivos Especficos
Reconocer un arreglo bidimensional. Construir aplicaciones con arreglos.
Contenido
ARREGLOS BIDIMENSIONALES Operaciones bsicas :
ingreso, listado, modificacin, ordenamiento.
Creacin
mat = new int[3][5];
num. FILAS :
mat.length
num. COLUMNAS :
mat
i 0
j 0
53 36 37
1
43 49 59
2
91 95 62
3
68 49 67
4
72 84 85
mat[i].length
Se usa una fila cualquiera
1 2
Problemas : Autoevaluacin
Se tiene un arreglo bidimensional de 4X6
mat
i
0 1 2
j
Reporte: 0 1 2 3 4 5
53 36 37 12 43 49 59 95 91 95 62 36 68 49 67 29 72 84 85 13 62 39 70 71
1. 2. 3. 4. 5.
Cantidad de nmeros. Suma de los nmeros. Promedio. Menor nmero. Mayor nmero.
mat
i i
i i
0
1 2 3
j
0
53
36 37 12
1
43
49 59 95
2
91
95 62 36
3
68
49 67 29
4
72
84 85 13
5
62
39 70 71
FILAS 4 COLUMNAS 6
mat
i
0 1 2
j
0
53 36 37 12
1
43 49 59 95
2
91 95 62 36
3
68 49 67 29
4
72 84 85 13
5
62 39 70 71
138 246
mat
0 1 2
j
0
53 36 37 12
1
43 49 59 95
2
91 95 62 36
3
68 49 67 29
4
72 84 85 13
5
62 39 70 71
ALGORITMO Recorrer todo el arreglo y sumar slo los elementos que se ubiquen en: - Primera columna. - ltima fila.
j=0 i = FILAS - 1
FILAS 4 COLUMNAS 6
mat
0 0 1 2
53 36 37 12
j
1
43 49 59 95
2
91 95 62 36
3
68 49 67 29
4
72 84 85 13
5
62 39 70 71
ALGORITMO Recorrer todo el arreglo y sumar slo los elementos que se ubiquen en: - ltima fila. - ltima columna.
i = FILAS - 1 j = COLUMNAS - 1
FILAS 4 COLUMNAS 6
mat
0 1 2
j
0
53 36 37 12
j
1
43 49 59 95
2
91 95 62 36
3
68 49 67 29
4
72 84 85 13
5
62 39 70 71
ALGORITMO Recorrer todo el arreglo y sumar slo los elementos que se ubiquen en: - Primera columna. - ltima columna. - ltima fila.
FILAS 4 COLUMNAS 6
mat
i
0 1 2
j
0
53 36 37 12
j
1
43 49 59 95
2
91 95 62 36
3
68 49 67 29
4
72 84 85 13
5
62 39 70 71
ALGORITMO Recorrer todo el arreglo y sumar slo los elementos que se ubiquen en: - Primera fila. - ltima fila. - Primera columna. - ltima columna.
FILAS 4 COLUMNAS 6
mat
i
0 1
j
0
53 36
1
43 49
2
91 95
3
68 49
4
72 84
5
62 39
2 3
37 12
59 95
62 36
67 29
85 13
70 71
j
0
53 53 36 37 12
1
43 43 49 59 95
2
91 91 95 62 36
3
68 68 49 67 29
4
72 72 84 85 13
5
62 62 39 70 71
j
0
53 53 36 37 12
1
43 43 49 59 95
2
91 91 95 62 36
3
68 68 49 67 29
4
72 72 84 85 13
5
62 62 39 70 71