We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2ae6cc2 + fc9e3f6 commit bba6735Copy full SHA for bba6735
Bubble Sort.java
@@ -15,15 +15,15 @@ public static void main(String[] args)
15
}
16
17
//Sorting
18
- for(int i=0; i<6; i++)
+ for(int i=0; i<5; i++)
19
{
20
- for(int j=0; j<5; j++)
+ for(int j=i+1; j<6; j++)
21
22
- if(array[j]>array[j+1])
+ if(array[j]>array[i])
23
24
int temp=array[j];
25
- array[j]=array[j+1];
26
- array[j+1]=temp;
+ array[j]=array[i];
+ array[i]=temp;
27
28
29
@@ -35,4 +35,4 @@ public static void main(String[] args)
35
36
37
38
-}
+}
0 commit comments