Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bubble Sort Java 2
//Aneesh Pradeeo 27/1/2020 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int arr[] ={3,60,35,2,45,320,5}; System.out.println("Before Bubble Sort"); for(int i=0; i < arr.length; i++){ System.out.print(arr[i] + " "); } System.out.println(); int n = arr.length; int temp = 0; for(int i = 0; i < n; i++) { for(int j=1; j < (n-i); j++) { if(arr[j-1] > arr[j]) { temp = arr[j-1]; arr[j-1] = arr[j]; arr[j] = temp; } } } System.out.println("After Bubble Sort"); for(int i=0; i < arr.length; i++){ System.out.print(arr[i] + " "); } System.out.println(); } }
run
|
edit
|
history
|
help
0
Even Numbers
Find if a String2 is substring of String1
Central Inteligence Agency
post decrement
update
add
Value pair analysis
2_Arpan Subba_Lincoln.java
homework
polymorphic mapper