Write a C++ program for bubble sort using template functions. code example
Example: bubble sort c++ template
// template <class t>
// void bubble <t>::sort(int n)
template < typename T > void bubble_sort( T a[], int n )
{
int i,j;
//t temp;
T temp ;
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(a[i]>a[j]) //bubble sort algo
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
}