From 1cc1abfe7b0447dc8d73d880d129f955a07b920e Mon Sep 17 00:00:00 2001 From: DulajMadushanka Date: Tue, 31 Oct 2017 02:34:36 +0530 Subject: [PATCH] Add buble sort --- buble sort.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 buble sort.java diff --git a/buble sort.java b/buble sort.java new file mode 100644 index 0000000..e411faf --- /dev/null +++ b/buble sort.java @@ -0,0 +1,18 @@ + public static void main(String[] args) { + int arr[] ={3,60,35,2,45,320,5}; + + System.out.println("Array Before Bubble Sort"); + for(int i=0; i < arr.length; i++){ + System.out.print(arr[i] + " "); + } + System.out.println(); + + bubbleSort(arr);//sorting array elements using bubble sort + + System.out.println("Array After Bubble Sort"); + for(int i=0; i < arr.length; i++){ + System.out.print(arr[i] + " "); + } + + } +} \ No newline at end of file