using System.Collections.Generic;

namespace Algorithm.BLL

...{
public class SortAlgorithm

...{
public List<int> QuickSort(List<int> list, int start, int end)

...{
int index = partition(list, start, end);
if (index-1 > start)
QuickSort(list, start, index);
if (index+1 < end)
QuickSort(list, index , end);
return list;
}

private int partition(List<int> list, int start, int end)

...{
int i = start - 1;
for (int j = start; j < end - 1; j++)

...{
if (list[j] <= list[end-1])

...{
i++;
int temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
int temp2 = list[i+1];
list[i + 1] = list[end-1];
list[end-1] = temp2;
return i + 1;
}
}
}








































