C#算法之冒泡排序实例
2014-06-27 17:23
232 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { int[] a = { 3, 4, 7, 10, 5, 9 }; int[] b = BubbleSort(a); for (int i = 0; i < b.Length; i++) { Console.Write(b[i].ToString() + " "); } Console.ReadLine(); } public static int[] BubbleSort(int[] list) { int i, temp; for (int j = 0; j < list.Length; j++) { for (i = list.Length - 1; i > j; i--) { if (list[j] < list[i]) { temp = list[j]; list[j] = list[i]; list[i] = temp; } } } return list; } } }
相关文章推荐
- c# 数据结构算法学习一:冒泡排序
- 【C#算法】冒泡排序 选择排序 插入排序 希尔排序--转
- 算法 - 冒泡排序(C#)
- C#计算两个文件的相对目录算法的实例代码
- C#算法之全排列递归算法实例讲解
- C#算法之“冒泡排序”
- c# 实现轮询算法实例代码
- js基本算法:冒泡排序,二分查找的简单实例
- 算法 - 冒泡排序(C#)
- C#实现排列组合算法完整实例
- C#算法基础之冒泡排序
- [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序
- Java数据结构及算法实例:冒泡排序 Bubble Sort
- c#算法-冒泡排序
- 数据结构与算法---C#实现LinkedList实例
- [数据结构与算法]C#冒泡排序
- Python排序搜索基本算法之冒泡排序实例分析
- C#获取关键字附近文字算法实例
- C#实现的海盗分金算法实例
- 小小c#算法题 - 0 - 单循环冒泡排序