0 calificaciones0% encontró este documento útil (0 votos)
12 vistas29 páginas
El documento presenta el análisis de complejidad de tiempo de dos funciones para encontrar la fila más repetida de una matriz. La función filaMasRepetidos() tiene una complejidad de O(n(f(n)+2)) donde f(n) es la complejidad de cuantosRepetidos(). Esta función tiene una complejidad de O(n^2) debido a los dos bucles anidados.
El documento presenta el análisis de complejidad de tiempo de dos funciones para encontrar la fila más repetida de una matriz. La función filaMasRepetidos() tiene una complejidad de O(n(f(n)+2)) donde f(n) es la complejidad de cuantosRepetidos(). Esta función tiene una complejidad de O(n^2) debido a los dos bucles anidados.
El documento presenta el análisis de complejidad de tiempo de dos funciones para encontrar la fila más repetida de una matriz. La función filaMasRepetidos() tiene una complejidad de O(n(f(n)+2)) donde f(n) es la complejidad de cuantosRepetidos(). Esta función tiene una complejidad de O(n^2) debido a los dos bucles anidados.
int tot=0; for(int i=0; i<vec.lenght;i++) { for(int j=0; j<vec.lenght;j++) { if( i!=j && vec[i]==vec[j]) { tot = tot + 1; return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { for(int j=0; j<vec.lenght;j++) { if( i!=j && vec[i]==vec[j]) { tot = tot + 1; return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { if( i!=j && vec[i]==vec[j]) { tot = tot + 1; return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { tot = tot + 1; return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n * n tot = tot + 1; return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 } static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) (f(n) + 2)*n cuantos = cuantosRepetidos(mat[i]); fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) (f(n) + 2)*n cuantos = cuantosRepetidos(mat[i]); (f(n) + 2)*n fila = i; return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) (f(n) + 2)*n cuantos = cuantosRepetidos(mat[i]); (f(n) + 2)*n fila = i; 1n return fila; }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) (f(n) + 2)*n cuantos = cuantosRepetidos(mat[i]); (f(n) + 2)*n fila = i; 1n return fila; 1 }
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
static int filaMasRepetidos(int[][] mat){ Universidad Nacional int cuantos=0, fila=-1; 2 De General Sarmiento for(int i=0; i<mat.lenght;i++) 1 + n + 1 + 2n = 3n + 2 if(cuantosRepetidos(mat[i])>cuantos) (f(n) + 2)*n cuantos = cuantosRepetidos(mat[i]); (f(n) + 2)*n fila = i; 1n return fila; 1 }
Cantidad total de instrucciones :
static int cuantosRepetidos(int[] vec){
int tot=0; 1 for(int i=0; i<vec.lenght;i++) { 1 + n + 1 + 2n = 3n + 2 for(int j=0; j<vec.lenght;j++) { (1 + n + 1 + 2n)*n = (3n + 2)*n if( i!=j && vec[i]==vec[j]) { 5n*n tot = tot + 1; 2n*n return tot; 1 }
Cantidad total de instrucciones :
Universidad Nacional De General Sarmiento
- Explicar quién es n en la demostración
- ¿Cuál es el peor caso del
algoritmo? Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
O(1*n) * O(log n) + O(2n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
O(n) * O(log n) + O(2n) Regla 3
O(n * log n) + O(2n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
O(n) * O(log n) + O(2n) Regla 3
O(n * log n) + O(2n) Regla 3
O(n * log n) + O(2) * O(n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
O(n) * O(log n) + O(2n) Regla 3
O(n * log n) + O(2n) Regla 3
O(n * log n) + O(2) * O(n) Regla 3
O(n * log n) + O(1) * O(n) Regla 4
Ejercicio 2 Universidad Nacional De General Sarmiento
O(4n * log n + 2n)
O(4n * log n) + O(2n) Regla 2
O(4n) * O(log n) + O(2n) Regla 3
O(4) * O(n) * O(log n) + O(2n) Regla 3
O(1) * O(n) * O(log n) + O(2n) Regla 4
O(n) * O(log n) + O(2n) Regla 3
O(n * log n) + O(2n) Regla 3
O(n * log n) + O(2) * O(n) Regla 3
O(n * log n) + O(1) * O(n) Regla 4
O(n * log n) + O(n) Regla 3
Ejercicio 2 Universidad Nacional De General Sarmiento
O(n * log n) + O(n)
O(max{n * log n}, n) Regla 2
Ejercicio 2 Universidad Nacional De General Sarmiento