-
Notifications
You must be signed in to change notification settings - Fork 13
My fork #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
My fork #6
Conversation
| public void ordenamiento(int[] arr) { | ||
| for(int i = 0; i < arr.length; i++){ | ||
| for(int j = i+1; j< arr.length; j++){ | ||
| if(arr[i]> arr[j]){ |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion attended, Thanks Christian!!!
| return null; | ||
| for(int i = 0; i < arr.length; i++){ | ||
| for(int j = i+1; j< arr.length; j++){ | ||
| if(arr[i]< arr[j]){ |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion attended, Thanks Christian!!!
| if (datos[i][j].equals(dato)) { | ||
| position.setX(i); | ||
| position.setY(j); | ||
| return position; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puedes buen uso de metodos setter, aunque tambien puedes devolver la creacion de instancion del objeto Posicion con el new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion attended, Thanks Christian!!!
| public String getData(String[][] datos, Posicion posicion) { | ||
| return null; | ||
| String data; | ||
| data = datos[posicion.getX()][posicion.getY()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aqui puede ahorrarte la asignacion de variable y devolver tal cual la posicion del array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion attended, Thanks Christian!!!
…nstructor Christian Gomez
I'd used the divide and conquer technique by implementing Quiksort on the Unidimentional array.
On the getPosition method the return statement was simplified just returning the constructor initialized with the indexes where the seeked data is, instead of initializing the setters explicitly. On the getData method the declaration of variables was reduced at it's minimum just returning the data on the given position instead of declaring a string variable and assigning it the value at the bidimentional array "datos" that the given position holds. Great assertions, Thanks for sharing your knowledge Christian!!!
When removing the element is made in time complexity O(1) (constant time), I just replace the erased element by the last element of the array. But when copying the temporal new array to the main array this is made in O(n). The resize() method increments by two ints sizes only if the current sizes is equal to the capacity of the main array.
get() method prints on raw screen command the element of the main array in the given index
I'd been on test week at school, that's why I'd a delay with this delivery, I apollogize for that.
Greeting!!!