如下的資料是關(guān)于C#快速排序演示的代碼,應(yīng)該對(duì)各位朋友有用處。
private static int Partition (int[] list, int i, int j)
{
int Key = list [i];
while (i < j)
{
while (list [j] >= Key && i < j)
j--;
if(i< j)
list [i++] = list [j];
while (list [i] <= Key && i < j)
i++;
IF (i < j)
list [j--] = list[i];
}
list [i] = Key;
return i;
}
public static void QuickSort (int[] list, int low, int high)
{
if(low < high - 1)
{
int Key = Partition (list, low, high);
QuickSort (list, low, Key - 1);
QuickSort (list, Key + 1, high);
}
}
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開啟,新人活動(dòng)云服務(wù)器買多久送多久。
文章標(biāo)題:C#快速排序源碼演示-創(chuàng)新互聯(lián)
網(wǎng)頁鏈接:http://chinadenli.net/article22/ddshjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、定制網(wǎng)站、網(wǎng)站改版、網(wǎng)站營(yíng)銷、外貿(mào)網(wǎng)站建設(shè)、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容