码迷,mamicode.com
首页 >  
搜索关键字:insertsort    ( 209个结果
二路插入排序
#include<iostream> using namespace std; typedef int SqList[8]; void Binpath_Insertsort(SqList &L,int count) { int length = count - 1; int L1[length] = ...
分类:编程语言   时间:2017-08-04 11:29:57    阅读次数:199
基本排序算法
插入排序 6. 重复步骤 2~5 function insertSort(arr){ var tmp; for(var i=1;i<arr.length;i++){ tmp = arr[i]; for(var j=i;j>=0;j--){ if(arr[j-1]>tmp){ arr[j]=arr[j ...
分类:编程语言   时间:2017-08-01 12:30:57    阅读次数:180
基础排序算法
七个基础排序算法(均为内部排序): 直接插入排序 希尔排序 冒泡排序 简单选择排序 高速排序 堆排序 二路归并排序 排序算法稳定性:经过排序后,具有同样关键码的元素之间的相对次序保持不变,则称该排序方法是稳定的;否则不稳定。 直接插入排序: void InsertSort(int a[],int n ...
分类:编程语言   时间:2017-07-30 12:56:15    阅读次数:284
直接插入排序(Straight Insertion Sort)
直接插入排序(Straight Insertion Sort)的基本操作是将一个记录插入到已经排好序的有序表中,从而得到一个新的、记录数增1的有序表。 /* 对顺序表L作直接插入排序 */ void InsertSort(SqList *L); 直接插入排序代码: // test.cpp : 定义控 ...
分类:编程语言   时间:2017-06-16 13:30:04    阅读次数:268
// 插入排序 源代码
//插入排序 void InsertSort(int *a,int n) { int i=0,j; for(;++i<n;) { for(j=i;--j>=0;) { if(a[j+1]<a[j]){ swap(&a[j+1],&a[j]); } else { break; } } //插入排序 v ...
分类:编程语言   时间:2017-05-28 11:01:27    阅读次数:147
算法之七种排序
插入排序 public static void insertSort(int[] t){ for(int i=1; i<t.length; i++){ //将第i个数提取出来 int temp = t[i]; int j; for(j=i-1; j>=0 && temp<t[j]; j--){ // ...
分类:编程语言   时间:2017-05-03 21:57:43    阅读次数:165
InsertSort
#include<stdio.h> #include<algorithm> using namespace std; int a[10000]={-1,4,5,2,1,3,7}; int n=5; void Is(){ for(int i=2;i<=n;i++){ if(a[i]<a[i-1]){ ...
分类:其他好文   时间:2017-05-01 19:46:48    阅读次数:150
直接插入排序
#include "stdafx.h" void insertSort(int* array,int len ) { // [0,i-1] [i,n-1] // 直接插入排序: [0,i-1]是已排序的序列 [i,n-1]是没有排序的序列 // 算法的核心思想:在已排序序列的[0,i-1]找到合适的... ...
分类:编程语言   时间:2017-04-25 10:03:40    阅读次数:159
插入排序和冒泡排序(Swift版本)
插入排序(只记录代码不作详细分析) 插入排序将输入的元素一个个插入到已排序的队列里,对比是由后往前 代码: func insertSort(_ arr: inout [Elem]) { for i in 1...arr.count-1 { let tmp = arr[i] for j in ... ...
分类:编程语言   时间:2017-02-03 16:51:37    阅读次数:185
直接插入排序
/** * 直接插入排序 * @author TMAC-J * 思路:详情见百度百科,解释的很清楚 * 这里没有对向后移动做优化,有兴趣的可以自己做做 * */ public class InsertSort { private int[] array; public InsertSort(int[... ...
分类:编程语言   时间:2017-01-06 15:27:33    阅读次数:243
209条   上一页 1 ... 5 6 7 8 9 ... 21 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!