BubbleSort
#include<stdio.h>
int main()
{
int i,j,t,a[]={3,9,7,1,4},n=5;
for(i=0;i<=(n-2);i++)
for(j=0;j<5-i-1;j++)
{ if(a[j]>a[j+1])
{t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
for(i=0;i<5;i++)
printf("%d,",a[i]);
return(0);
}
int main()
{
int i,j,t,a[]={3,9,7,1,4},n=5;
for(i=0;i<=(n-2);i++)
for(j=0;j<5-i-1;j++)
{ if(a[j]>a[j+1])
{t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
for(i=0;i<5;i++)
printf("%d,",a[i]);
return(0);
}
CountingSort
#include<stdio.h>
int main()
{
int i,t,a[]={8,7,4,1,0,5,9,2},b[]={0,0,0,0,0,0,0,0,0,0},j,k=0;
for(i=0;i<8;i++)
printf("%d,",a[i]);
printf("\n\n");
for(i=0;i<8;i++)
{ t=a[i];
b[t]=b[t]+1;
}
for(i=0;i<10;i++)
printf("%d,",b[i]);
printf("\n\n");
for(i=0;i<10;i++)
{ if(b[i]==0)
continue;
t=b[i];
for(j=0;j<t;j++)
{a[k]=i;
k++;
}
}
for(i=0;i<8;i++)
printf("%d,",a[i]);
printf("\n\n");
/*Time complexity 3n*/
return(0);
}
int main()
{
int i,t,a[]={8,7,4,1,0,5,9,2},b[]={0,0,0,0,0,0,0,0,0,0},j,k=0;
for(i=0;i<8;i++)
printf("%d,",a[i]);
printf("\n\n");
for(i=0;i<8;i++)
{ t=a[i];
b[t]=b[t]+1;
}
for(i=0;i<10;i++)
printf("%d,",b[i]);
printf("\n\n");
for(i=0;i<10;i++)
{ if(b[i]==0)
continue;
t=b[i];
for(j=0;j<t;j++)
{a[k]=i;
k++;
}
}
for(i=0;i<8;i++)
printf("%d,",a[i]);
printf("\n\n");
/*Time complexity 3n*/
return(0);
}
HeapSort
#include<stdio.h>
int main()
{
int i,a[]={0,68,-7,45,6,57},n=6,t,k,l;
int b[n+1];
int left,right,pos,j,parent;
for(i=0;i<6;i++)
{
b[i+1]=a[i];
j=i+1;
while(1)
{
parent=j/2;
if(parent<1)
break;
if(b[parent]>=b[j])
break;
t=b[parent];
b[parent]=b[j];
b[j]=t;
j=parent;
}
}
for(i=1;i<7;i++)
printf("%d,",b[i]);
printf("\n\n");
for(i=1;i<=n;i++)
{
a[n-i]=b[1];
l=n-i+1;
b[1]=b[l];
l--;
j=1;
while(1)
{
left=2*j;
right=2*j+1;
if(left>l)
break;
if(right>l)
{
if(b[j]>b[left])
break;
t=b[j];
b[j]=b[left];
b[left]=t;
break;
}
if(b[left]>b[right])
pos=left;
else
pos=right;
if(b[j]>b[pos])
break;
t=b[pos];
b[pos]=b[j];
b[j]=t;
j=pos;
}
}
for(i=0;i<6;i++)
printf("%d,",a[i]);
printf("\n\n");
/*Time complexity nlog(base 2)n*/
/*For Quick and Merge too.*/
return(0);
}
int main()
{
int i,a[]={0,68,-7,45,6,57},n=6,t,k,l;
int b[n+1];
int left,right,pos,j,parent;
for(i=0;i<6;i++)
{
b[i+1]=a[i];
j=i+1;
while(1)
{
parent=j/2;
if(parent<1)
break;
if(b[parent]>=b[j])
break;
t=b[parent];
b[parent]=b[j];
b[j]=t;
j=parent;
}
}
for(i=1;i<7;i++)
printf("%d,",b[i]);
printf("\n\n");
for(i=1;i<=n;i++)
{
a[n-i]=b[1];
l=n-i+1;
b[1]=b[l];
l--;
j=1;
while(1)
{
left=2*j;
right=2*j+1;
if(left>l)
break;
if(right>l)
{
if(b[j]>b[left])
break;
t=b[j];
b[j]=b[left];
b[left]=t;
break;
}
if(b[left]>b[right])
pos=left;
else
pos=right;
if(b[j]>b[pos])
break;
t=b[pos];
b[pos]=b[j];
b[j]=t;
j=pos;
}
}
for(i=0;i<6;i++)
printf("%d,",a[i]);
printf("\n\n");
/*Time complexity nlog(base 2)n*/
/*For Quick and Merge too.*/
return(0);
}
InsertionSort
#include<stdio.h>
int main()
{
int i,j,t,a[]={5,9,3,0,1},n=5;
for(i=0;i<=n-2;i++)
{
if(a[i]<=a[i+1])
continue;
j=i+1;
t=a[j];
while(j>=1 && a[j-1]>t)
{ a[j]=a[j-1];
j--;
}
a[j]=t;
}
for(i=0;i<n;i++)
printf("%d,",a[i]);
return(0);
}
int main()
{
int i,j,t,a[]={5,9,3,0,1},n=5;
for(i=0;i<=n-2;i++)
{
if(a[i]<=a[i+1])
continue;
j=i+1;
t=a[j];
while(j>=1 && a[j-1]>t)
{ a[j]=a[j-1];
j--;
}
a[j]=t;
}
for(i=0;i<n;i++)
printf("%d,",a[i]);
return(0);
}
MergeSort
#include<stdio.h>
void mergesort(int a[],int left,int right);
void main()
{
int i;
int a[]={9,6,8,2,5,90,-8,4,1,10};
mergesort(a,0,9);
for(i=0;i<10;i++)
printf("%d,",a[i]);
printf("\n\n");
}
void mergesort(int a[],int left,int right)
{
int c[10];
int p,mid,i,j,k;
if(left>=right)
return;
mid=(left+right)/2;
mergesort(a,left,mid);
mergesort(a,mid+1,right);
i=left;
j=mid+1;
k=0;
while(i<=mid && j<=right)
{
if(a[i]<=a[j])
{
c[k]=a[i];
i++;
}
else
{
c[k]=a[j];
j++;
}
k++;
}
if(i<=mid)
for(p=i;p<=mid;p++)
{
c[k]=a[p];
k++;
}
else
for(p=j;p<=right;p++)
{
c[k]=a[p];
k++;
}
for(i=left;i<=right;i++)
a[i]=c[i-left];
printf("\nleft=%d right=%d\n",left,right);
for(i=0;i<10;i++)
printf("%d,",a[i]);
printf("\n\n");
}
void mergesort(int a[],int left,int right);
void main()
{
int i;
int a[]={9,6,8,2,5,90,-8,4,1,10};
mergesort(a,0,9);
for(i=0;i<10;i++)
printf("%d,",a[i]);
printf("\n\n");
}
void mergesort(int a[],int left,int right)
{
int c[10];
int p,mid,i,j,k;
if(left>=right)
return;
mid=(left+right)/2;
mergesort(a,left,mid);
mergesort(a,mid+1,right);
i=left;
j=mid+1;
k=0;
while(i<=mid && j<=right)
{
if(a[i]<=a[j])
{
c[k]=a[i];
i++;
}
else
{
c[k]=a[j];
j++;
}
k++;
}
if(i<=mid)
for(p=i;p<=mid;p++)
{
c[k]=a[p];
k++;
}
else
for(p=j;p<=right;p++)
{
c[k]=a[p];
k++;
}
for(i=left;i<=right;i++)
a[i]=c[i-left];
printf("\nleft=%d right=%d\n",left,right);
for(i=0;i<10;i++)
printf("%d,",a[i]);
printf("\n\n");
}
QuickSort
#include<stdio.h>
void quicksort(int a[],int left,int right);
int main()
{
int i,fp,pivot,t,a[]={9,1,17,3,10,-8,5},n=7;
quicksort(a,0,n-1);
for(i=0;i<n;i++)
printf("%d,",a[i]);
return(0);
}
void quicksort(int a[],int left,int right)
{
int i,fp,pivot,t;
if(left>=right)
return;
fp=left;
pivot=a[left];
for(i=left + 1;i<=right;i++)
{
if(a[i]>=pivot)
continue;
fp++;
t=a[i];
a[i]=a[fp];
a[fp]=t;
}
t=a[fp];
a[fp]=pivot;
a[left]=t;
quicksort(a,left,fp-1);
quicksort(a,fp+1,right);
}
void quicksort(int a[],int left,int right);
int main()
{
int i,fp,pivot,t,a[]={9,1,17,3,10,-8,5},n=7;
quicksort(a,0,n-1);
for(i=0;i<n;i++)
printf("%d,",a[i]);
return(0);
}
void quicksort(int a[],int left,int right)
{
int i,fp,pivot,t;
if(left>=right)
return;
fp=left;
pivot=a[left];
for(i=left + 1;i<=right;i++)
{
if(a[i]>=pivot)
continue;
fp++;
t=a[i];
a[i]=a[fp];
a[fp]=t;
}
t=a[fp];
a[fp]=pivot;
a[left]=t;
quicksort(a,left,fp-1);
quicksort(a,fp+1,right);
}
SelecionSort
#include<stdio.h>
int main()
{
int i,j,smallpos,a[]={3,9,7,1,4},t;
for(i=0;i<1;i++)
{
smallpos=i;
for(j=i+1;j<=4;j++)
if(a[j]<a[smallpos])
smallpos=j;
t=a[smallpos];
a[smallpos]=a[i];
a[i]=t;
a[0]=a[i];
}
printf("%d",a[0]);
return(0);
}
int main()
{
int i,j,smallpos,a[]={3,9,7,1,4},t;
for(i=0;i<1;i++)
{
smallpos=i;
for(j=i+1;j<=4;j++)
if(a[j]<a[smallpos])
smallpos=j;
t=a[smallpos];
a[smallpos]=a[i];
a[i]=t;
a[0]=a[i];
}
printf("%d",a[0]);
return(0);
}
If you're leaving in Goa and looking for independent Goa escorts, you're at proper vicinity. heighten your senses that is certain to land you in the paradise. The friendly, fantastic and lovely searching girls will provide a pampering massage to every massage is mainly made to be ideal for each customer. Make a call and a stunning mistress will be there to accompany you and satisfy your fantasies. it's far always top notch to e-book such offerings in a lodge room because the ambience could be super. within the privateness and comfort of your own home or a resort room. A lovely version escort in Goa can bring the real sensuality of an erotic massage to you water seduction massages, four arms massages or whatever you crave from them. version escorts at Goa offer relaxing massages, frame to body massages, The specialized, professional and skilled touch of skilled rubdown therapists will help rejuvenate the frame after a annoying day. You just want to present a name to a model escort and Independent Call Girls in Goa the relaxation might be taken care of.
ReplyDeletethey have changed the which means actual nearness. Lovemaking is not the finest issue the present couples choice. companions have started out themselves for more picks and always try new things in intercourse. nowadays, people try various factors of foreplay and attain first-rate climax. long past are the days of restrained moves in real nearness. For current numerous, there are numerous actions engaged in foreplay. it's far clearly crucial for numerous have amusing with foreplay. Orgasm is simply part of dating-associated dating motion but to accomplish such climax, It isn't always wrong to say that it's far more vital than climax. Foreplay has continually been an notable key for pleasure and fun itself. It lights each the people and calls for them forward for more success and a laugh. http://www.jennygurgaonescorts.in/ High Profile Call Girls Service in Gurgaon Foreplay performs an awesome component in real nearness.
ReplyDeleteguy wants to meet up with high-quality female Independent Call girls in Mumbai . We cannot refuse the point that beauty continually recommendations.
ReplyDeleteEscorts in Bandra use categorised clothes to preserve her role. Her outfit will appearance soon her curvaceous and well beautifully shaped human frame. She preserves herself without a doubt nicely. you will sense diagnosed whilst you meet her. You would love to appearance her all time. You cannot take your sight to different course when you see her very warm decide and The woman you will meet has shapely framework that will increase her standard seems. except their beauty, you'll be pleased with the aid of their usual individual. pop out of your tedious lifestyles; meet terrific and lovely Bandra escorts. man likes the existence of a super girl in his way of life. You would love her life in your lifestyle. If you are a person looking for a high-quality and young woman, unbiased Call Girls in Bandra can be your accomplice.
ReplyDeleteit'd be your one of the excellent encounters. she will be able to boom you and revitalize you truly. she will by no means can help you down. She is ready to meet up with you and take you to the arena of heavenly amusing and leisure. Meet to Diana soon a female who knows how to please your feelings and cure your sight. guy continually likes to grope her female in glossy and soothing way. She likes to be kissed cautiously on her mouth and fondling is her way to actual success. She has her character feelings too that she desires to join up with. She is attached to conference enthusiastic lovers who can simply like her crazily. She likes realistic and right down to international individuals. She by no means likes people who do now not regard female. Her targets are pretty wonderful and vashi escorts or she offers her business enterprise to high-profile clients.
ReplyDeleteI regularly meet a business character from Western area of India. however, plenty of them additionally look for precise companionship. They look for dating fun or eroticism commonly. I often meet some mid aged individuals. We loved dancing and later romancing on mattress in a inn room. where I wanted to electrify him with my dancing skills. We went in a discotheque of Andheri, smooth to mingle with man or woman. I accompanied him, and that i noticed that he's a totally friendly and He wanted to visit a few locations near to Andheri with me. He was a foreigner, and he was on his ride to India. i have met exceptional styles of human beings. for instance, Andheri Escorts had as soon as met an extremely a laugh loving and adventurous guy.
ReplyDeletei really like to be enjoyed on mattress by way of men. After that, the maximum passionate classes for eroticism come. We talk to every other and spend good time. that i meet them on the venues that they want. They inquire from me for relationship, and recognise the exceptional erotic hints to arouse men. They need my Mumbai escort provider, as i'm expert, lovely and I also meet some customers, who just want to spend proper moments with a hot and scorching woman. I’m no longer hesitant on trying special dating orgasmic pleasures. He gets naughty with my body, and that i continually permit him to get raunchy. He appreciates me for my open minded attitude. We generally meet at some 5-big name motel, revel in meals collectively, and juhu escorts then share some good moments talking to every others.
ReplyDeleteSexy Call Girls in Mumbai are just a call away. They are genuine people – many normal colleges going girls are fake and we boys understand that very well.
ReplyDeleteMumbai Call Girls
Call Girls in Mumbai
Call Girls Service in Mumbai
Mumbai Call Girls Service
Welcome to Mumbai Call Girls Service. You have reached your destination of the search of the beautiful, erotic, seductress and charming ladies and girls.
Mumbai Call Girls
Call Girls in Mumbai
Call Girls Service in Mumbai
Mumbai Call Girls Service
Find beautiful young Jaipur Escorts for satisfaction. High class and top class Independent escorts in Jaipur. Jaipur Escorts Service is very nice.
ReplyDeleteJaipur Escorts
Escorts in Jaipur
Call Girls in Jaipur
Jaipur Escorts Service
Hi I am Indian Jaipur Escorts Agency a Jaipur Escorts Girl available 24 hours for erotic escort services in Jaipur. I present independent escort services to vip clients in Jaipur.
Jaipur Escorts
Escorts in Jaipur
Call Girls in Jaipur
Jaipur Escorts Service
Andheri Escorts Service Visit here this Site :- Andheri Escorts Service
ReplyDeleteAndheri Escorts
Juhu escorts ServiceVisit Site :- Juhu escorts Service
Juhu escorts
Bandra Escorts Visit Site :- Bandra Escorts
Bandra Escorts Service
Vashi Escorts Visit Site :- Vashi Escorts
Escorts in Vashi
Dadar escorts Service Visit on this Site :- Dadar escorts Service
Dadar Escorts
Escorts in Chembur Visit on this Site :- Escorts in Chembur
Chembur Escorts
Andheri Escorts Service Visit here this Site :- Andheri Escorts Service
Andheri Escorts
Juhu escorts ServiceVisit Site :- Juhu escorts Service
Juhu escorts
Bandra Escorts Visit Site :- Bandra Escorts
Bandra Escorts Service
Vashi Escorts Visit Site :- Vashi Escorts
Escorts in Vashi
Dadar escorts Service Visit on this Site :- Dadar escorts Service
Dadar Escorts
Escorts in Chembur Visit on this Site :- Escorts in Chembur
Chembur Escorts
Worli Escorts Visit Site :- Worli Escorts
Worli Escorts Service
Lower Parel Escorts Visit Site :- Lower Parel Escorts
Lower Parel Escorts Service
Nariman Point Escorts Visit Site :- Nariman Point Escorts
Nariman Point Escorts Service
delhi girls number
ReplyDeletefree indian girls mobile number for friendship
indian phone friendship numbers
indian girls cell phone number
indian girlfriends mobile no
delhi girls phone number
girls phone no in india
mobile numbers of girls
delhi college girl
delhi girls phone number
For your kind knowledge, you have to note that before you go on date with such pretty escort, it is you who has to find out the rate of best escort service in delhi. Once you are done then you can stay highly relaxed. In the same way, you will still be able to
ReplyDeleteenjoy the best form of fun.
High profile Call Girls in Mumbai
ReplyDeleteEscort Dating in Mumbai
Beauties Mumbai Independent Escorts
Dashing Call girls in Mumbai
Fair complexion Call girls in Mumbai
Curvy figures Mumbai Escorts Services
Sizzling Erotic Mumbai Escorts
Mumbai Women seeking Man
Sizzling hot Independent Escort in Mumbai
Beautiful Female Escorts Services in Mumbai
Airhostess Companionin Delhi
ReplyDelete