Skip to content

Conversation

@Ed9ar
Copy link

@Ed9ar Ed9ar commented Sep 11, 2022

No description provided.

Posicion pos = new Posicion(0, 0);
for(int i = 0; i < datos.length; i++){
for(int j = 0; j < datos[i].length;j++){
if(datos[i][j].equals(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 tambien utilizar la creacion del objecto Posicion con new, esto solo te ahorra lineas codigo

int x = posicion.getX();
int y = posicion.getY();

return datos[x][y];
Copy link
Owner

Choose a reason for hiding this comment

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

puedes usar los getter dentro del array en lugar de asignacion de variables

public class UnidimensionalImpl implements Unidimensional {
@Override
public void ordenamiento(int[] arr) {
Arrays.sort(arr);
Copy link
Owner

Choose a reason for hiding this comment

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

Buen uso de herramientas existentes

int[] arrcopy = new int[arr.length];

int counter = 0;
for(int i = arr.length-1; i >= 0 ;i--){
Copy link
Owner

Choose a reason for hiding this comment

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

puedes volver a usar Arrays.sort() pero usando un comparator, que puedes pasar como parametro

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