
c++ noj
碳酸钙的01妖精
这个作者很懒,什么都没留下…
展开
-
稀疏矩阵三元组相加(三元顺序组创建,相加,输出)
矩阵相加(三元组表)#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXN 200typedef struct{ int i,j; int elem;}triple;//一个点的三元组。typedef struct{ triple data[MAXN]; i...原创 2018-06-20 12:03:37 · 1472 阅读 · 0 评论 -
输出以二叉树表示的算术表达式(先序遍历创建+中序遍历输出)
输出以二叉树表示的算术表达式#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct Node{ char Data; struct Node* LChild; struct Node* RChild; //先序遍历创建}BiTNode,*PB...原创 2018-06-20 08:52:29 · 2317 阅读 · 0 评论 -
任意两点间的最短距离 (Floyd_Warshall算法)
任意两点间的最短距离 (Floyd算法)时间复杂度 O(n^3)#include <stdio.h>#include <stdlib.h>#define inf 0x3f3f3f3fint dis[200][200];int min(int a,int b){ if(a<b) return a; else r...原创 2018-06-20 08:52:04 · 1189 阅读 · 0 评论 -
计算二叉树叶子结点数目(先序遍历创建+先序遍历输出)
计算二叉树叶子结点数目#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct Node{ char Data; struct Node* LChild; struct Node* RChild;}BiTNode,*PBiTNode;int cnt=0;void...原创 2018-06-20 08:51:48 · 3026 阅读 · 0 评论 -
建立二叉树的二叉链的存储结构((先序遍历创建+先序遍历输出))
建立二叉树的二叉链的存储结构#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct Node{ char Data; struct Node* LChild; struct Node* RChild;}BiTNode,*PBiTNode;void Create...原创 2018-06-20 08:51:35 · 960 阅读 · 0 评论 -
建立二叉树的二叉链表(已知先序和中序,求后序)
建立二叉树的二叉链表(已知先序和中序,求后序)#include <stdio.h>#include <stdlib.h>#include <string.h> //原理:由前序和中序可以确定唯一的二叉树typedef struct Node{ char Data; struct Node* LChild; struct Node* RCh...原创 2018-06-20 08:51:10 · 1297 阅读 · 0 评论 -
单源最短路径(dijkstra算法 + 路径从小到大输出)
#include <stdio.h>#include <stdlib.h>#include <string.h>#define inf 0x3f3f3f3fint dis[200];int vis[200];int map[200][200];struct mmm{ int x; int y; int v;}xxx[200];void dijk...原创 2018-06-20 08:50:51 · 698 阅读 · 0 评论 -
哈希表(除留余数法构造 线性探测再散列法处理冲突)
哈希表(除留余数法构造 线性探测再散列法处理冲突)#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ int a[11]={22,41,53,46,30,13,1,67},b[11]; int i; int n,t; n=8; //n是a数组元素的...原创 2018-06-20 08:50:28 · 11110 阅读 · 0 评论 -
二叉排序树 (创建+插入+删除)
二叉排序树 (创建+插入+删除)#include <stdio.h>#include <stdlib.h>typedef struct Node{ int Data; struct Node *LChild; struct Node *RChild; int Ltag; int Rtag;}BSTNode,*PBSTNode;...原创 2018-06-20 08:49:12 · 533 阅读 · 1 评论 -
二叉排序树的判断
二叉排序树的判断#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct Node{ char Data; struct Node* LChild; struct Node* RChild; //先序遍历创建}BiTNode,*PBiTNode...原创 2018-06-20 08:48:55 · 355 阅读 · 0 评论 -
二叉排序树 (合并)
二叉排序树 (合并)#include <stdio.h>#include <stdlib.h>typedef struct Node{ int Data; struct Node *LChild; struct Node *RChild; int Ltag; int Rtag;}BSTNode,*PBSTNode;void ...原创 2018-06-20 08:48:29 · 864 阅读 · 0 评论 -
单源最短路径(dijkstra算法 + 按最短路径输出各个节点)
#include <stdio.h>#include <stdlib.h>#include <string.h>#define inf 0x3f3f3f3fint dis[200];int vis[200];int map[200][200];struct mmm{ int x; int y; int v;}xxx[200];void dijk...原创 2018-06-20 08:47:45 · 1494 阅读 · 0 评论 -
单源最短路径(dijkstra算法)
//时间复杂度 O(n^2)#include <stdio.h>#include <stdlib.h>#include <string.h>#define inf 0x3f3f3f3fint map[200][200];int vis[200];int dis[200]; //单源最短路径,dis...原创 2018-06-20 12:02:00 · 389 阅读 · 1 评论 -
稀疏矩阵十字链表的储存形式(十字链表的创建与相加)
矩阵十字链表的储存形式(十字链表的创建与相加)#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct node{ int i,j; int elem; struct node *right,*down;}cnode,*clink;typedef struct{...原创 2018-06-20 12:02:43 · 443 阅读 · 0 评论 -
广义表的创建与深度
广义表的创建与深度#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>//算法://测str长度,三种情况,最后一种创建List L,p;//删除str括号,(先创建,再删除)//判断str长度(未删除括号)//获取hstr,与subs.//递归构造//回溯...原创 2018-06-20 08:52:44 · 303 阅读 · 0 评论