insertSort - 插入排序
来源:互联网 发布:淘宝电商哪个机构好 编辑:程序博客网 时间:2024/05/12 18:46
插入排序类似于抓扑克牌
#include <iostream>#include <string>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>#include <vector>#include <stack>#include <deque>#include <queue>#include <bitset>#include <list>#include <map>#include <set>#include <iterator>#include <algorithm>#include <functional>#include <utility>#include <sstream>#include <climits>#include <cassert>#define BUG puts("here!!!");using namespace std;const int N = 50;void insertSort(int a[], int len) { int j; for(int i = 1; i < len; i++) {// 新抓的每张扑克牌 int temp = a[i]; for(j = i-1; a[j] > temp && j >= 0; j--) { a[j+1] = a[j]; } a[j+1] = temp; }}int main() { int a[] = {8, 5, 4, 9, 2, 3, 6}; insertSort(a, 7); for(int i = 0; i < 7; i++) { cout << a[i] << ' '; } cout << endl; return 0;}
- 插入排序InsertSort
- insertSort - 插入排序
- 插入排序 InsertSort
- 插入排序 InsertSort
- 插入排序(InsertSort)
- 插入排序InsertSort
- 插入排序-InsertSort
- java insertsort 插入排序
- 插入排序-insertsort
- 插入排序(InsertSort)
- 插入排序(InsertSort)
- InsertSort 插入排序算法
- 数据结构-插入排序InsertSort
- InsertSort(插入排序)
- 排序算法-插入排序 insertSort
- 排序算法-InsertSort-插入排序
- 插入排序算法(InsertSort)
- 经典算法-插入排序Insertsort
- 草根程序员转型做项目管理走过的点点滴滴之(十四、五)人团队2013年团队建设目标续篇
- 解决国外模板h1、h2、h3...不显示中文文章标题的问题
- mergeSort - 归并排序
- 特殊的日子(转)
- 图像识别
- insertSort - 插入排序
- 覆盖,不只是覆盖
- ARM-Linux时钟初始化
- Java加密技术(一)——BASE64与单向加密算法MD5&SHA&MAC
- 操作系统大型实验进展(13)-----bieset
- bubbleSort - 冒泡法排序
- hdu 1785 结构体排序
- 送上一款注册表清理regclean pro,顺便求助哈,求大神解决
- selectSort - 选择排序