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

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - 三文鱼

叶问 弧线枪法 我是传奇 赤壁~之战 也说动物园展示蟒蛇吃活鸡 终于知道g9是谁了 人生的蝴蝶效应 杭州之行 广州车展 西安之行 变形金刚真是火 C#写的几个基本的排序算法(三) C#写的几个基本的排序算法(一) 数据库惊现"NULL" 换了个计数器 应该了解的垃圾收集机制(二) 应该了解的垃圾收集机制(一) 中国队输了 别把代码写成“密码”
C#写的几个基本的排序算法(二)
三文鱼 · 2007-06-27 · via 博客园 - 三文鱼

快速排序:

 1class QuickSortSample
 2    {
 3        CommonFunctions<int> _funcs = new CommonFunctions<int>();
 4
 5        public void Sort(int[] values, int begin, int end)
 6        {
 7            if (begin < end)
 8            {
 9                int p = Partition(values, begin, end);
10
11                Sort(values, begin, p - 1);
12                Sort(values, p + 1, end);
13            }

14        }

15
16        public int Partition(int[] values, int begin, int end)
17        {
18            int i = begin - 1;
19            
20            for (int j = begin; j < end ; j++)
21            {
22                if (values[j] < values[end])
23                {
24                    i++;
25                    _funcs.ExchangValues(ref values[j], ref values[i]);
26                }

27            }

28
29            i++;
30            _funcs.ExchangValues(ref values[i], ref values[end]);
31
32            return i;
33        }

34
35        static void Main()
36        {
37            int[] values = {4375890126 };
38
39            QuickSortSample quickSort = new QuickSortSample();
40            quickSort.Sort(values, 0, values.Length - 1);
41
42            foreach (int i in values)
43            {
44                Console.Write(i + "  ");
45            }

46        }

47    }