Tuesday 8 November 2016

DATA -STRUCTURE (DS) IN C++ BUBBLE SORT PROGRAMMING

CODINGCLASSES|LEARNTOPROGRAM



DATA -STRUCTURE (DS) IN C++  BUBBLE SORT  PROGRAMMING 



#include<iostream.h>
#include<conio.h>
void main()
{
int n,i,j,temp;                                 //intiliaze of variable 
int a[50];
cout<<" Enter the size of  linear array";
cin>>n;
cout<<"Enter the size of an element of an array ";
for(i=0; i<=n;  i++)
{
cin>>a[i];
for(j=0; j<n;  j++)
{
cout<<a[j];
}
for(i=0; i<=n-1; i++ )
}
for(j=0; j<=n-1; j++)
{
if( a[j]> a[j+1])
{                                                       
temp =a[j];                                           //swaping method
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout<<"Data after sorting ";
for(j=0; j<n;  j++)
{
cout<<a[j];
}
getch();
}


If you have any doubt plz comment below if you have any question then commnent below or send me mail
thanku for visiting !!

No comments:

Post a Comment