Bubble Sort Record
Bubble Sort Record
Bubble Sort Record
24
AIM:
ALGORITHM:
#include<iostream>
int n;
int main()
{
cout<<"Enter the number of Array Elements: ";
cin>>n;
cout<<endl;
int arr[n];
cout<<"Enter "<<n<<" Array Elements: "<<endl;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<"Unsorted Array Elements: ";
for(int i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
cout<<"Sorted Array Elements: ";
bubblesort(arr);
for(int i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
return 0;
}
INPUT AND OUTPUT:
RESULT:
Thus the given array is sorted using Bubble Sort algorithm in C++ language.