From 92eab0f52455d671f21a852058882e5762648763 Mon Sep 17 00:00:00 2001 From: TheDarKnight13 <49570517+TheDarKnight13@users.noreply.github.com> Date: Tue, 21 May 2019 13:10:02 +0400 Subject: [PATCH 1/3] Add files via upload --- Adithya_bubble.cpp | 29 ++++++++++++++++++++++++ Adithya_modular exponentiation.cpp | 36 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 Adithya_bubble.cpp create mode 100644 Adithya_modular exponentiation.cpp diff --git a/Adithya_bubble.cpp b/Adithya_bubble.cpp new file mode 100644 index 0000000..2f181f5 --- /dev/null +++ b/Adithya_bubble.cpp @@ -0,0 +1,29 @@ +#include +int main() +{ + int n,j,i,a[100]; + printf("Enter the number of elements"); + scanf("%d",&n); + printf("Enter the elements"); + for(i=0;ia[j+1]) + { + int temp=a[j]; + a[j]=a[j+1]; + a[j+1]=temp; + } + } +} +printf("The ordered pair is \n"); +for(i=0;i +#include +int rem (int c, int d,int t, int& res) +{ + d=d%c; + if(t==1) + { + res=res*d; + } + d=d*d; + return d; + +} +int main() +{ + int i,k,a,b,b1,c,bin[100],ans,res=1,m=1; + printf("Enter a,b,c as a^b mod c"); + scanf("%d %d %d",&a,&b,&c); + b1=b; + i=0; + + while(b1>0) + { + bin[i]=b1%2; + b1=b1/2; + i++; + } + for(k=0;k Date: Tue, 21 May 2019 22:59:45 +0400 Subject: [PATCH 2/3] Add files via upload --- Adithya_Qsort.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Adithya_Qsort.cpp diff --git a/Adithya_Qsort.cpp b/Adithya_Qsort.cpp new file mode 100644 index 0000000..bceb5c0 --- /dev/null +++ b/Adithya_Qsort.cpp @@ -0,0 +1,60 @@ +#include +struct point //the variable is a structure which stores the value of the abcissa and the ordinate +{ + int a,b; +}; +void swap(point&t1, point&t2) //for swapping +{ + point temp; + temp=t1; + t1=t2; + t2=temp; +} +int partition(point w[1000], int low, int high) //used to find the position to divide the array into 2 about a pivot element +{ + int k; + point pivot = w[high]; //The pivot is chosen as the last element of the array + int i = low-1; + + for(k= low; k<=high-1; k++) + { + if(w[k].a < pivot.a || (w[k].a == pivot.a && w[k].b<=pivot.b ) ) //Element smaller than the pivot are moved forward + { + i++; + swap(w[k],w[i]); + + } + + } + swap(w[i+1],w[high]); //This brings the pivot element to the right postion in the ordered array + return (i+1); //returns the position about which the array is to be divided +} +void quicksort(point w[1000], int low, int high) +{ + if(low Date: Tue, 21 May 2019 23:15:20 +0400 Subject: [PATCH 3/3] Add files via upload