protected void Button2_Click(object sender, EventArgs e)
{
string res_arr = string.Empty;
QuickSort(arr_list, 0, arr_list.Length-1);
foreach(int i in arr_list)
{
res_arr += i + ",";
}
Response.Write(res_arr + "<br/>");
Response.Write(count);
}
private void QuickSort(int[] n,int left,int right)
{
int i = left,j = right,tem;
tem = n[left];
while(i < j)
{
while (n[j] > tem && i < j)
{
--j;
++count;
}
n[i] = n[j];
while (n[i] <= tem && i < j)
{
++i;
++count;
}
n[j] = n[i];
++count;
}
n[i] = tem;
if (i - 1 > left) QuickSort(n,left,i-1);
if (right > i + 1) QuickSort(n,i+1,right);
}