using System;
using System.Collections.Generic;
using System.Text;
namespace SortAlgorithms
{
class EbullitionSorter
{
public enum Derection {litter,big };
public void Sort(int[] arr)
{
int i, j, temp;
bool done = false;
j = 1;
while ((j < arr.Length) && !(done))
{
done = true;
for (i = 0; i < arr.Length - j; i++)
{
if (arr[i] > arr[i + 1])
{
done = false;
temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
}
}
j++;
}
}
public void Sort(int[] arr, Derection derection)
{
if(arr.Length>1)
{
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr.Length - 1; j++)
{
if (derection == Derection.litter)
{
if (arr[i] < arr[j])
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
else
{
if (arr[i] > arr[j])
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
}
}
}
//static void Main(string[] args)
//{
// int[] arry = new int[] { 1, 3, 2, 6, 3, 4 };
// EbullitionSorter e = new EbullitionSorter();
// e.Sort(arry,Derection.big);
// foreach (int m in arry)
// {
// Console.WriteLine("{0}", m);
// }
// Console.ReadLine();
//}
}
}