C# 冒泡排序
来源:互联网 发布:dotamax数据更新 编辑:程序博客网 时间:2024/06/06 06:37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace maopao
{
class Sort
{
static void BubbleSort(int[] array)
{
for (int i = 0; i < array.Length; i++)
{
for (int j = 0; j < array.Length - i - j; j++)
{
if (array[j] > array[j + 1])
{
int tmp = array[j];
array[j] = array[j + 1];
array[j + 1] = tmp;
}
}
foreach (int a in array)
{
Console.Write(a + " ");
}
Console.Write(Environment.NewLine);
}
}
static void Main(string[] args)
{
int[] a = new int[] { 26, 32, 35, 33, 21, 24, 7 };
BubbleSort(a);
Console.Read();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace maopao
{
class Sort
{
static void BubbleSort(int[] array)
{
for (int i = 0; i < array.Length; i++)
{
for (int j = 0; j < array.Length - i - j; j++)
{
if (array[j] > array[j + 1])
{
int tmp = array[j];
array[j] = array[j + 1];
array[j + 1] = tmp;
}
}
foreach (int a in array)
{
Console.Write(a + " ");
}
Console.Write(Environment.NewLine);
}
}
static void Main(string[] args)
{
int[] a = new int[] { 26, 32, 35, 33, 21, 24, 7 };
BubbleSort(a);
Console.Read();
}
}
}
0 0
- 冒泡排序C#版
- C# 冒泡排序
- c# 冒泡排序
- C#冒泡排序
- C# 冒泡排序!
- C#实现冒泡排序
- C# 冒泡排序法
- C#冒泡排序
- C#冒泡排序
- C# 冒泡排序
- C# 冒泡排序
- c# 冒泡排序
- C#冒泡排序代码
- C#冒泡排序
- c#冒泡排序法
- c# 泛型 冒泡排序
- c#冒泡排序算法
- C#冒泡排序
- Java 之 何以一见钟情 《第一个Java程序和Applet程序》
- 设计模式——工厂模式(Factory Pattern)
- C#中的foreach语句
- CF267 div2 C 区间DP
- seo团队人员的合理配置
- C# 冒泡排序
- http://bar.cnyes.com/html/100102-1/8D1A047651DE6F2.shtml
- http://bar.cnyes.com/html/100102-1/8D1A047651DE6F2.shtml
- UVALive-6656-Watching the Kangaroo(二分)
- linux 查看公网ip
- E: 无法获得锁 /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)解决方法
- Codeforces Round #267 (Div. 2) A
- Codeforces Round #267 (Div. 2) B
- c++ bit field