惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - 阿伟

转一个哥们的日记看了让你吐血 IT技术和职位小览和应聘注意事项 生活中的笑话 男人25岁前的忠告(转) 经典承诺 怎样对待男人和女人之间关系 插入排序(C#) 如何关闭常见端口(113、4899、389、6129等端口) 一些字符串操作的常用用法 - 阿伟 - 博客园 选择排序(C#) C#常用函数 几个网络术语!~ net命令研究 股票术语集锦 找女朋友的标准,男人不看后悔一辈子!!! DataGrid自定义分页存储过程 男生给女生最牛B的告白 一个光棍的呐喊! 令人呕吐的几则笑话^_^
快速排序(c#)
阿伟 · 2006-03-04 · via 博客园 - 阿伟

using System;


namespace QuickSorter
{
 
public class QuickSorter
 
{
  
private void Swap(ref int l,ref int r)
  
{
   
int s;
   s
=l;
   l
=r;
   r
=s;
  }

  
public void Sort(int [] list,int low,int high)
  
{
   
int pivot;
   
int l,r;
   
int mid;
   
if(high<=low)
    
return;
   
else if(high==low+1)
   
{
    
if(list[low]>list[high])
     Swap(
ref list[low],ref list[high]);
    
return;
   }

   mid
=(low+high)>>1;
   pivot
=list[mid];
   Swap(
ref list[low],ref list[mid]);
   l
=low+1;
   r
=high;
   
do
   
{
   
while(l<=r&&list[l]<pivot)
    l
++;
   
while(list[r]>=pivot)
    r
--;
    
if(l<r)
     Swap(
ref list[l],ref list[r]);
   }
while(l<r);
   list[low]
=list[r];
   list[r]
=pivot;
   
if(low+1<r)
    Sort(list,low,r
-1);
   
if(r+1<high)
    Sort(list,r
+1,high);
  }

 }

 
public class MainClass
 

  
public static void Main()
  
{
   
int[] iArrary=new int[]{1,5,3,6,10,55,9,2,87,12,34,75,33,47};
   QuickSorter q
=new QuickSorter();
   q.Sort(iArrary,
0,13);
   
for(int m=0;m<=13;m++)
    Console.WriteLine(
"{0}",iArrary[m]);  
  }

 }



}