int *BubbleSort(int ar[], int size)
{
bool sorted = false;
while (sorted == false)
{
sorted = true;
for (int i = 0; i < size; i++)
{
if (ar[i] > ar[i + 1])
{
swap(ar[i], ar[i + 1]);
sorted = false;
}
}
}
return ar;
}