diff --git a/Sorting/bubbleSort/bubble_sort.cpp b/Sorting/bubbleSort/bubble_sort.cpp new file mode 100644 index 000000000..0f27e42f1 --- /dev/null +++ b/Sorting/bubbleSort/bubble_sort.cpp @@ -0,0 +1,33 @@ +/* Bubble Sort implementation in C++ + * Author : Manvi Gupta + * Input : array length and elements + * Output : Sorted array elements + */ +#include +using namespace std; + +int n; + +void bubble_Sort(int a[]) + { + + for(int i=0; i a[j+1]) + { + swap(a[j+1], a[j]); + } + } + + int main() + { + cin >> n; + int a[n]; + for(int i=0; i> a[i]; + bubble_Sort(a); + for (int i = 0; i < n; i++) { + std::cout << a[i] << '\n'; + } + return 0; + }