From b7439c89b0f957e530b2f9f9c131a09b730315d8 Mon Sep 17 00:00:00 2001 From: protto1 <73750377+protto1@users.noreply.github.com> Date: Sat, 31 Oct 2020 20:56:17 +0530 Subject: [PATCH] Create bubbleSort --- Sorting/bubbleSort | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Sorting/bubbleSort diff --git a/Sorting/bubbleSort b/Sorting/bubbleSort new file mode 100644 index 0000000..215a9dc --- /dev/null +++ b/Sorting/bubbleSort @@ -0,0 +1,20 @@ +#include +using namespace std; +void bubbleSort(int arr[], int n){ + for(int i=0;iarr[j+1]){ + swap(arr[j],arr[j+1]); + } + } + } +} +int main() +{ + int a[]={3,2,5,6,4}; + int m=sizeof(a)/sizeof(a[0]); + bubbleSort(a, m); + for(int i=0;i