From 16f1dc3ab1c27e2abcbc22c78e16b43980785cd3 Mon Sep 17 00:00:00 2001 From: shivammaniharsahu <48375036+shivammaniharsahu@users.noreply.github.com> Date: Sat, 12 Oct 2019 18:23:12 +0530 Subject: [PATCH 1/3] Add files via upload --- Searching/binary search.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Searching/binary search.cpp diff --git a/Searching/binary search.cpp b/Searching/binary search.cpp new file mode 100644 index 0000000..53f20b6 --- /dev/null +++ b/Searching/binary search.cpp @@ -0,0 +1,43 @@ +#include +using namespace std; +int main() +{ + int i,n,k,beg=0,end,mid,f=0,ar[100],ele; + cout<<"Enter Your no. of element"; + cin>>n; + for(i=0;i>ar[i]; + } + end=n-1; + cout<<"Enter element to find="; + cin>>ele; + while(beg<=end) + { + mid=(end+beg)/2; + if(ar[mid]==ele) + { + k=mid+1; + f=1; + break; + } + else if(ar[mid] Date: Sat, 12 Oct 2019 18:36:08 +0530 Subject: [PATCH 2/3] Add files via upload --- .../swap without using 3 variable.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Swap-without-third-variable/swap without using 3 variable.cpp diff --git a/Swap-without-third-variable/swap without using 3 variable.cpp b/Swap-without-third-variable/swap without using 3 variable.cpp new file mode 100644 index 0000000..0050e5b --- /dev/null +++ b/Swap-without-third-variable/swap without using 3 variable.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; +int main() +{ + int a,b; + cout<<"Enter value of a = "; + cin>>a; + cout<<"Enter value of b = "; + cin>>b; + a=a-b; + b=a+b; + a=b-a; + cout<<"After swaping value of a = "<