diff --git a/bubbleSort.java b/bubbleSort.java new file mode 100644 index 0000000..126a657 --- /dev/null +++ b/bubbleSort.java @@ -0,0 +1,35 @@ +public class bubbleSort { + + public static void main(String[] args) { + bubbleSort obj = new bubbleSort(); + + int a[] = {64, 34, 89, 49, 52, 71}; + + obj.bubbleSort(a); + System.out.println("Sorted Array : "); + obj.printArray(a); + } + + public void bubbleSort(int a[]) + { + for(int i=0; i a[j+1]) + { + int temp = a[j]; + a[j] = a[j+1]; + a[j+1] = temp; + } + } + } + public void printArray(int a[]) + { + for(int i=0; i