From 21bf905dfbe673ceacafc4e0cdf10937b376688c Mon Sep 17 00:00:00 2001 From: NoorFatima Date: Sun, 17 Oct 2021 13:52:49 +0500 Subject: [PATCH] adding file --- DataStructures/bubble sort.cpp | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 DataStructures/bubble sort.cpp diff --git a/DataStructures/bubble sort.cpp b/DataStructures/bubble sort.cpp new file mode 100644 index 00000000..bf1ae0a3 --- /dev/null +++ b/DataStructures/bubble sort.cpp @@ -0,0 +1,51 @@ +#include +using namespace std; + +void Bubble_sort(int size,int A[]) //bubble up +{ + for(int i=0; iA[j+1]) + { + int temp=A[j]; + A[j]=A[j+1]; + A[j+1]=temp; + flag=1; + } + + } + if(flag==0) + { break; + + } + + } + + cout<<"\n After sort"; + + for(int i=0; i>size; + int A[10]; + cout<<"Enter the values of aray\n"; + for(int i=0; i>A[i]; + } + Bubble_sort(size,A); + return 0; +}