From ad6212c69fb86cdc2cd7d1f9dee8b6b015cfbdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cant=C3=B3=20Abad?= Date: Fri, 17 Mar 2017 09:46:51 +0100 Subject: [PATCH 1/3] optimizing bubble --- Bubble Sort.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Bubble Sort.java b/Bubble Sort.java index b1147d1ba637..6560cf2aee34 100644 --- a/Bubble Sort.java +++ b/Bubble Sort.java @@ -2,22 +2,23 @@ class BubbleSort { + private final static int TAM=6; public static void main(String[] args) { - int array[]=new int[6]; + int array[]=new int[TAM]; Scanner input=new Scanner(System.in); //Input System.out.println("Enter any 6 Numbers for Unsorted Array : "); - for(int i=0; i<6; i++) + for(int i=0; i=0; i--) { - for(int j=0; j<5; j++) + for(int j=0; j<=TAM; j++) { if(array[j]>array[j+1]) { @@ -35,4 +36,4 @@ public static void main(String[] args) } } -} \ No newline at end of file +} From c2bbf3843232dea347fe92b846f108a30cf86741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cant=C3=B3=20Abad?= Date: Tue, 21 Mar 2017 11:27:04 +0100 Subject: [PATCH 2/3] Revert "optimizing bubble" This reverts commit ad6212c69fb86cdc2cd7d1f9dee8b6b015cfbdf4. reversing optimization --- Bubble Sort.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Bubble Sort.java b/Bubble Sort.java index 6560cf2aee34..b1147d1ba637 100644 --- a/Bubble Sort.java +++ b/Bubble Sort.java @@ -2,23 +2,22 @@ class BubbleSort { - private final static int TAM=6; public static void main(String[] args) { - int array[]=new int[TAM]; + int array[]=new int[6]; Scanner input=new Scanner(System.in); //Input System.out.println("Enter any 6 Numbers for Unsorted Array : "); - for(int i=0; i=0; i--) + for(int i=0; i<6; i++) { - for(int j=0; j<=TAM; j++) + for(int j=0; j<5; j++) { if(array[j]>array[j+1]) { @@ -36,4 +35,4 @@ public static void main(String[] args) } } -} +} \ No newline at end of file From 3bd812f0544c56a05f4c7116fbe6ba6cf4ee58f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Garc=C3=ADa?= Date: Mon, 26 Mar 2018 11:27:57 +0200 Subject: [PATCH 3/3] comentario llaves --- Factorial.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Factorial.java b/Factorial.java index f675ba6a1273..d4cade61e4b4 100644 --- a/Factorial.java +++ b/Factorial.java @@ -22,7 +22,7 @@ public static void main(String[] args){ //Factorial method public static long factorial(int n){ - +// DEMASIADAS LLAVES if (n==0){ return 1; } else if (n==1){ @@ -32,4 +32,4 @@ public static long factorial(int n){ } } -} \ No newline at end of file +}