上一页 1 ··· 3 4 5 6 7

2020年5月9日

摘要: 1 //在一边有序的序列中,不断的插入从另一边遍历到的元素 2 //该程序是降序排列 3 void Insertion_Sort(ElementType a[], int n) { 4 int i, p, t; 5 for (p = 1; p < n; p++) { 6 t = a[p]; 7 // 阅读全文

posted @ 2020-05-09 10:25 黑炽 阅读(96) 评论(0) 推荐(0) 编辑

摘要: 1 void bubble_Sort(ElementType a[], int n) { 2 for (int p = n - 1; p >= 0; p--) {//需要p趟冒泡,也就是每次把一个最大的放到前面 3 int flag = 0;//标志是否发生元素交换 4 for (int i = 0 阅读全文

posted @ 2020-05-09 10:02 黑炽 阅读(130) 评论(0) 推荐(0) 编辑

2020年5月8日

摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 //系数 coefficient,coef 4 //指数 exponent, expon 5 typedef struct polyNode* polynomial; 6 struct polyNode { 7 i 阅读全文

posted @ 2020-05-08 12:13 黑炽 阅读(472) 评论(0) 推荐(0) 编辑

摘要: typedef struct GNode* PtrToGNode; typedef PtrToGNode MGraph; /* 以邻接矩阵存储的图类型 */ bool Visited[MaxVertexNum]; /* 顶点的访问标记 */ struct GNode { int Nv; /* 顶点数 阅读全文

posted @ 2020-05-08 10:56 黑炽 阅读(234) 评论(0) 推荐(0) 编辑

摘要: /*层次遍历,其实就是一个队列,先把根节点压入,之后进入循环,每次先弹出一个根节点,在输出值后,将其左右子树分别压入队列*/ void InorderTraversal(BinTree BT) { BinTree T; Stack S = CreateStack(100);//创建并初始化堆栈 wh 阅读全文

posted @ 2020-05-08 09:07 黑炽 阅读(210) 评论(0) 推荐(0) 编辑

2020年5月6日

摘要: 1 #include<cstdio> 2 #include<stdlib.h> 3 #include<algorithm> 4 #define INF 10000000000 5 #define LL long long 6 using namespace std; 7 8 int a[100001 阅读全文

posted @ 2020-05-06 21:09 黑炽 阅读(128) 评论(0) 推荐(0) 编辑

摘要: 1 /*第一种,就是写二分函数 2 因为要按照a数组的顺序输出,那么则把b数组排序之后进行二分查找 3 若a中该元素存在b数组,则输出即可 4 */ 5 #include<stdio.h> 6 #include<stdlib.h> 7 #include<string.h> 8 9 int binar 阅读全文

posted @ 2020-05-06 14:02 黑炽 阅读(260) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7