Sorting means to sort an array of data. Say you had an array of numbers
[2,4,6,1,3,5] and you sorted it (in ascending order), you'd get
[1,2,3,4,5,6].
There are many different types of sorting, refered to as sorting algorithms. You can find out about some of the primary ones (bubble, selection, insertion, merge, and quick)
Descending Order
There are many different types of sorting, refered to as sorting algorithms. You can find out about some of the primary ones (bubble, selection, insertion, merge, and quick)
Bubble Sorting
Descending Order
//SORTING By Using Bubble Sorting Method
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int i,j,temp;
int A[5]={6,3,9,1,5};
cout<<"Sorting Using Bubble Sorting Method \n";
cout<<"THE ORIGINAL ARRAY IS: \n";
for(i=0;i<5;i++)
cout<<A[i];
cout<<"\n";
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(A[j]<A[j+1])
{
temp=A[j];
A[j]=A[j+1];
A[j+1]=temp;
}
}
}
cout<<"\n";
cout<<"the sorted array is \n";
for(i=0;i<5;i++)
cout<<A[i];
cout<<endl;
getch();
}
OUTPUT:
4 comments:
I need to communicate my deference of your composing aptitude and capacity to make perusers read from the earliest starting point as far as possible. I might want to peruse more up to date presents and on share my musings with you.
https://360digitmg.com/course/project-management-professional-pmp
I think this is an extraordinary article. You make this information interesting and secures. You give perusers a lot to consider and I esteem such a forming.
iot training in delhi
Hello there to everyone, here everybody is sharing such information, so it's fussy to see this webpage, and I used to visit this blog day by day
what is hrdf
Excellence blog! Thanks For Sharing, The information provided by you is really a worthy. I read this blog and I got the more information about
data scientist courses aurangabad
Post a Comment