Skip to content

Conversation

@ItzMont
Copy link

@ItzMont ItzMont commented Sep 12, 2022

Se realizaron los 4 ejercicios de los 2 problemas con arreglos y matrices.

int val;
//System.out.println(arr.length);
for (int i = 0;i < arr.length-2;i++){
if (arr[i]>arr[i+1]){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puedes ver si hay una mejora de ordenamiento con respecto a tu actual solucion, hay algoritmos mas rapidos que puedes implementar incluso Arrays.sort()

for(int j = 0; j < datos[i].length ;j++){
if(datos[i][j] == dato){
//System.out.println(i + " + " +j);
return pos = new Posicion(1,2);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No necesitas una asignacion aqui, sufieciente con regresar la creacion de instancia

int y = posicion.getY();
String dato;
dato = datos[x][y];
return dato;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

puedes ahorra codigo solo poniendo return datos[posicion.getX(), posicion.getY()]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants