一、直接插入排序
对于一个有序的序列,不断将后面的元素插入前面的有序序列,保持序列继续有序。
对于直接插入排序的思路:将要排序的元素保存,然后逐个和其前面的元素进行比较,如果前面的元素比其大,则将前面的元素后移一个。
时间复杂度为n*n
void insert_sort(int a[],int n)
{
int i,j;
int temp;
for(i=1;i<n;i++...
分类:
编程语言 时间:
2015-07-13 12:18:28
阅读次数:
144
需要温度和风场U/V分量格点数据,计算中主要用到cdiff函数,结果正确与否未经验证(希望有人用GrADS验证一下)。脚本程序:print 'Open data files...'f_air = addfile('D:/Temp/nc/air.2011.nc')f_uwnd = addfile('D...
分类:
其他好文 时间:
2015-07-12 18:43:39
阅读次数:
257
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1思路:利用temp进行交换,采用递归从顶至下,终止条件本身为空或者是叶子节点。...
分类:
其他好文 时间:
2015-07-12 18:40:49
阅读次数:
128
public static void BubbleSort(T[] arrayList) where T : IComparable { for (int i = 0; i 0) { T temp = arrayList[j]; ...
分类:
其他好文 时间:
2015-07-12 12:33:00
阅读次数:
109
#include
using namespace std;
int main(void)
{
int x, y, num1, num2, temp;
printf("请输入两个正整数:\n");
scanf("%d %d", &num1, &num2);
if(num1 < num2)//交换
{
num1^=num2;...
分类:
编程语言 时间:
2015-07-11 20:16:33
阅读次数:
140
1、单个的字符或者数字 void swap(int *a,int *b) { int temp=*a; *a=*b; *b=temp; } int main() { int a=10,b=100; swap(&a,&b); cout<<a<<"\t"<<b<<endl; return 0; } 2、...
分类:
其他好文 时间:
2015-07-11 16:28:59
阅读次数:
172
小标记一下,数据库大量重复数据去除下面是一个根据重复的name 移除的create table temp select max(id) as id from table1 group by name ;//name分组 拿到最大id 保存到临时表delete table1 where id not ...
分类:
数据库 时间:
2015-07-11 13:27:06
阅读次数:
158
void Reverse(char* pBegin, char* pEnd)
{
if (pBegin == NULL || pEnd == NULL)
return;
while (pBegin
{
char temp = *pBegin;
*pBegin = *pEnd;
*pEnd = temp;
pBegin++, pEnd--;
}
}
char*...
分类:
其他好文 时间:
2015-07-11 09:17:52
阅读次数:
187
oracle初学者常用操作100问
1. Oracle安装完成后的初始口令?
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
2. oracle中的裸设备指的是什么?
裸设备就是绕过文件系统直接访问的储存空间。
3....
分类:
数据库 时间:
2015-07-11 09:03:28
阅读次数:
161
public class BubbleSort { public static void Sort(int[] arr) { int temp = 0; for (int i = 0; i arr[j + 1]) ...
分类:
编程语言 时间:
2015-07-10 15:05:02
阅读次数:
107