From 2331b5253276c1fab49b7f5de1d520a48011078f Mon Sep 17 00:00:00 2001 From: Anna Emmanuel <42714414+Annamaliakal@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:34:07 +0530 Subject: [PATCH 1/2] Adding Bubble Sort in C++ --- SortingAlgorithms/C++/Bubble_Sort.cpp | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 SortingAlgorithms/C++/Bubble_Sort.cpp diff --git a/SortingAlgorithms/C++/Bubble_Sort.cpp b/SortingAlgorithms/C++/Bubble_Sort.cpp new file mode 100644 index 0000000..b92b85f --- /dev/null +++ b/SortingAlgorithms/C++/Bubble_Sort.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; + +void bubble_sort(int a[],int n){ + int t; + for(int i=0;i>n; + int a[n]; + cout<<"Enter the elements: "; + + for(int i=0;i>a[i]; + } + + bubble_sort(a,n); + + cout<<"Sorted array: "; + for(int i=0;i Date: Fri, 30 Oct 2020 11:52:26 +0530 Subject: [PATCH 2/2] Added a new program file --- hackerrank/Aray/ArraysIntroduction.cpp | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 hackerrank/Aray/ArraysIntroduction.cpp diff --git a/hackerrank/Aray/ArraysIntroduction.cpp b/hackerrank/Aray/ArraysIntroduction.cpp new file mode 100644 index 0000000..df228ba --- /dev/null +++ b/hackerrank/Aray/ArraysIntroduction.cpp @@ -0,0 +1,36 @@ +/* + Arrays Introduction + + You will be given an array of integers and you have to print the integers in the reverse order. + + Sample Input + + 4 + 1 4 3 2 + + Sample Output + + 2 3 4 1 + +*/ + +#include + +using namespace std; + + +int main() { + int n; + cin>>n; + int a[n]; + for(int i=0;i>a[i]; + + } + for(int i=n-1;i>=0;i--){ + cout<