当前位置:首页 >> 求写出使用插入排序算法进行排序的伪代码 >>


伪代码如下 INSERTION-SORT(A) 1forj← 2tolength[A] 2dokey←A[j] 3InsertA[j] into the sorted sequenceA[1..j-1]. 4i←j-1 5whilei>0 andA[i] >key 6doA[i+1] ←A[i] 7i←i-1 8A[i+1] ←key C语言代码如下 void insertion_sort(int array[],int fir...

for j = 2 to A.length 就是j从2循环到A.length的意思,A.length就是数组A的长度。 这句相当于for(j=2;j

int a[]={33,76,26,88,15,92,37,49},i,j.k; for(i=0;i

#include #include typedef struct BiTnode { int data; struct BiTnode *lchild,*rchild; }BiTnode,*BiTree; BiTree search_tree(BiTree T,int keyword,BiTree *father) { BiTree p; *father = NULL; p = T; while (p && p->data!=keyword) { *...

#include int main() {int a[20]={23,14,22,45,13,90,45,67,83,84,56,44,22,45}; int n=14,i,j,t,e; printf("原有的数据:\n"); for(i=0;i

网站首页 | 网站地图
All rights reserved Powered by www.lmmp.net
copyright ©right 2010-2021。