dsalglib
1.0.0
dsalglib is a ready to use data structures and algorithms library written in C++ . Object Oriented Template implementations are written.
Main Page
Namespaces
Classes
Files
File List
File Members
source
include
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
dsa::swapit
void swapit(T &x, T &y)
Definition:
alginc.h:17
dsa
Definition:
alginc.h:12
dsa::bubblesort
void bubblesort(array< type > arr, long long int size)
Definition:
bubblesort.h:13
array.h
dsa::array
Definition:
array.h:10
Generated by
1.8.11