-
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
Changes from 2 commits
ff2f9cc
6a8dfee
0b8730a
db68062
0dfbe3d
dd04278
cd4db70
c8a2bca
c36bdde
98c01ce
279c808
e0e17eb
69f08ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,28 @@ | |
| import com.oracle.arrays.model.Posicion; | ||
|
|
||
| public class MultidimensionalImpl implements Multidimensional { | ||
| Posicion position; | ||
|
|
||
| @Override | ||
| public Posicion getPosition(String[][] datos, String dato) { | ||
| position = 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)) { | ||
| position.setX(i); | ||
| position.setY(j); | ||
| return position; | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public String getData(String[][] datos, Posicion posicion) { | ||
| return null; | ||
| String data; | ||
| data = datos[posicion.getX()][posicion.getY()]; | ||
|
||
| return data; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,32 @@ | |
| public class UnidimensionalImpl implements Unidimensional { | ||
| @Override | ||
| 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]){ | ||
|
||
| int temp = arr[i]; | ||
| arr[i]= arr[j]; | ||
| arr[j]= temp; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public int[] ordenamientoReversa(int[] arr) { | ||
| return null; | ||
| for(int i = 0; i < arr.length; i++){ | ||
| for(int j = i+1; j< arr.length; j++){ | ||
| if(arr[i]< arr[j]){ | ||
|
||
| int temp = arr[i]; | ||
| arr[i]= arr[j]; | ||
| arr[j]= temp; | ||
| } | ||
| } | ||
| } | ||
| int cpyArr [] = new int[arr.length]; | ||
| for(int i = 0; i<arr.length; i++){ | ||
| cpyArr[i]= arr[i]; | ||
| } | ||
| return cpyArr; | ||
| } | ||
| } | ||
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!!!