INSERTION-SORT(A)的C++代码
来源:互联网 发布:苗阜相声水平知乎 编辑:程序博客网 时间:2024/06/07 00:56
书中伪代码:
for j <- 2 to length[A] do key <- A[j] i <- j - 1 while i > 0 and A[i] > key do A[i+1] <- A[i] i <- i -1 A[i+1] <- key
我的C++代码实现:
void Insertion_Sort(int *List,int length){ for(int j = 1;j < length;j++){ int key = List[j]; int i = j - 1; while(i >= 0 && List[i] > key){ List[i+1] = List[i]; i--; } List[i+1] = key; }}
- INSERTION-SORT(A)的C++代码
- leetcode上的Sort a linked list using insertion sort
- Sort a linked list using insertion sort
- Sort a linked list using insertion sort
- (C#)插入排序 Insertion Sort
- cf-362C-Insertion Sort
- Codeforces 362C. Insertion Sort
- codeforces 362c Insertion Sort
- C. Insertion Sort----构造题
- leetcode_Sort a linked list using insertion sort.
- 数据结构 - 直接插入排序(Straight Insertion Sort) 详解 及 代码(C++)
- 数据结构 - 折半插入排序(Binary Insertion Sort) 详解 及 代码(C++)
- cf——C. Insertion Sort
- Codeforces 362C. Insertion Sort【构造】
- [C++] 插入排序法 (Insertion sort)
- c编写 Insertion or Heap Sort
- 【LeetCode】147. Insertion Sort List C语言
- 147. Sort a linked list using insertion sort
- hdoj1159 (dp 最长公共子序列)
- 原创快速哈希算法 FHA1
- 朴素贝叶斯分类算法(Naive Bayesian classification)
- 数据库 左外连接 右外连接 内连接
- 11
- INSERTION-SORT(A)的C++代码
- 回文数字 (2013年11月24日 蓝桥杯校内选拔赛c\c++B组)
- 第十二节cocosdx的屏幕适配的问题
- ubuntu安装使用ffmpeg
- 在C# 中使DataGridView控件隔行显示不同的颜色
- 第十三节cocosdx的按键增加过程
- 数字游戏 (2013年11月24日 蓝桥杯校内选拔赛c\c++B组)
- 用递归法将一个整数n转化成字符串
- 第十四节cocosdx的声音接口