From 0ec31f8167c91eb1e72a6f2a979a89822fbb7517 Mon Sep 17 00:00:00 2001 From: Sejal Rathore <61845736+sejal1126@users.noreply.github.com> Date: Sun, 18 Oct 2020 18:21:42 +0530 Subject: [PATCH 1/2] Create linearsearch.cpp This program will find the element from the array --- linearsearch.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 linearsearch.cpp diff --git a/linearsearch.cpp b/linearsearch.cpp new file mode 100644 index 0000000..5dbc298 --- /dev/null +++ b/linearsearch.cpp @@ -0,0 +1,29 @@ +#include + +using namespace std; + +int main() +{ int n=0,i=0,num=0,max=0,pos=0; + cout<<"\t\tProgram on Linear Search"; + cout<<"\nEnter the size of array : ";cin>>n; + int a[n]; + cout<<"Enter the array elements :\n"; + for(i=0;i>a[i];} + cout<<"Enter the search elemnet :";cin>>num; + max=0; + for(i=0;i Date: Sun, 18 Oct 2020 18:27:47 +0530 Subject: [PATCH 2/2] Create Bubblesort.cpp --- Bubblesort.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Bubblesort.cpp diff --git a/Bubblesort.cpp b/Bubblesort.cpp new file mode 100644 index 0000000..f2b361d --- /dev/null +++ b/Bubblesort.cpp @@ -0,0 +1,35 @@ +#include + +using namespace std; + +int main() +{ int n=0,i=0,max=0; + cout<<"\t\tProgram on Bubble sort"; + cout<<"\nEnter the size of array : ";cin>>n; + int a[n]; + cout<<"Enter the array elements :\n"; + for(i=0;i>a[i];} + int j=0; + max=0; + for(i=0;ia[j+1]) + { + max=a[j]; + a[j]=a[j+1]; + a[j+1]=max; + }} + } + + } + cout<<"Sorted Element are :"; + for(i=0;i