dsalglib  1.0.0
dsalglib is a ready to use data structures and algorithms library written in C++ . Object Oriented Template implementations are written.
bubblesort.h
Go to the documentation of this file.
1 //
2 // Created by moghya_s on 10/2/2016.
3 //
4 
5 #ifndef DSALGLIB_BUBBLESORT_H
6 #define DSALGLIB_BUBBLESORT_H
7 
8 #include "array.h"
9 namespace dsa
10 {
11 
12  template<typename type>
13  void bubblesort( array<type> arr,long long int size)
14  {
15  long long int i,j;
16  for(i=0;i<size;i++)
17  {
18  for(j=1;j<size;j++)
19  {
20  if(arr[j]<arr[j-1])
21  swapit(arr[j],arr[j-1]);
22  }
23  }
24  }
25 }
26 #endif //DSALGLIB_BUBBLESORT_H
void swapit(T &x, T &y)
Definition: alginc.h:17
Definition: alginc.h:12
void bubblesort(array< type > arr, long long int size)
Definition: bubblesort.h:13