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

推荐订阅源

美团技术团队
W
WeLiveSecurity
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
F
Full Disclosure
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
G
Google Developers Blog
C
Check Point Blog
GbyAI
GbyAI
A
About on SuperTechFans
V
Vulnerabilities – Threatpost
T
The Blog of Author Tim Ferriss
T
Tor Project blog
AWS News Blog
AWS News Blog
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
MongoDB | Blog
MongoDB | Blog
Latest news
Latest news
aimingoo的专栏
aimingoo的专栏
U
Unit 42
Y
Y Combinator Blog
P
Privacy International News Feed
Cisco Talos Blog
Cisco Talos Blog
S
Securelist
S
Schneier on Security
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
P
Proofpoint News Feed
C
Cisco Blogs
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
P
Privacy & Cybersecurity Law Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
罗磊的独立博客
Cloudbric
Cloudbric
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Security Blog
Microsoft Security Blog

博客园 - 夜帝

无进程木马 思路 [转] DateTime 日期操作 C#开发终端式短信的原理和方法 JavaScript实现功能全集 全国网络广播电台地址 转 C#调用Windows API函数 AJAX基础教程 C#一个显示分页页码类 C#实现窗体淡入淡出效果的几种方法 如何用C#语言构造蜘蛛程序 - 夜帝 - 博客园 用Visual C#编写仿MSN Messager的滚动提示窗口 创建不规则窗体和控件 初识C#线程 JavaScript中文版(入门) C#日期函数所有样式大全 C#中的“装箱”(boxing)与“拆箱”(unboxing) .net 中随机数的产生 使用C#开发COM+组件 C#算法 -- (三)希尔排序
C#冒泡排序算法
夜帝 · 2007-09-14 · via 博客园 - 夜帝

public void BubbleSort(int[] R)
  {
   int i,j,temp;
   //交换标志
   bool exchange;
   //最多做R.Length-1趟排序
   for(i=0; i<R.Length; i++)
   {
   //本趟排序开始前,交换标志应为假
   exchange=false;
   for(j=R.Length-2; j>=i; j--)
   {
   //交换条件
   if(R[j+1]<R[j])
   {
   temp=R[j+1];
   R[j+1]=R[j];
   R[j]=temp;
   //发生了交换,故将交换标志置为真
   exchange=true;
   }
   }
   //本趟排序未发生交换,提前终止算法
   if(!exchange)
   {
   break;
   }
   }
  }

二、
using System;

namespace BubbleSorter
{
public class BubbleSorter
{
public void Sort(int [] list)
{
int i,j,temp;
bool done=false;
j=1;
while((j<list.Length)&&(!done))
{
done=true;
for(i=0;i<list.Length-j;i++)
{
if(list[i]>list[i+1])
{
done=false;
temp=list[i];
list[i]=list[i+1];
list[i+1]=temp;
}
}
j++;
}

}
}
public class MainClass
{
public static void Main()
{
int[] iArrary=new int[]{1,5,13,6,10,55,99,2,87,12,34,75,33,47};
BubbleSorter sh=new BubbleSorter();
sh.Sort(iArrary);
for(int m=0;m<iArrary.Length;m++)
Console.Write("{0} ",iArrary[m]);
Console.WriteLine();
}
}
}