From a50c1e91b13762cf63f3e99f72851ae551e7cc5a Mon Sep 17 00:00:00 2001 From: GitanshKapoor <72307552+GitanshKapoor@users.noreply.github.com> Date: Sat, 3 Oct 2020 19:30:02 +0530 Subject: [PATCH] Create bubble Sort --- bubble Sort | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bubble Sort diff --git a/bubble Sort b/bubble Sort new file mode 100644 index 0000000..673e8e0 --- /dev/null +++ b/bubble Sort @@ -0,0 +1,16 @@ + + +#include +#include + + +void bubble_sort (int a[], int n) { + int i, j; + for(i = 0; i < n-1; ++i) { + for(j = 0; j < n-i-1; ++j) { + if(a[j+1] < a[j]) { + swap(a[j],a[j+1]); + } + } + } +}