
数据结构
守着麦田的稻草人
这个作者很懒,什么都没留下…
展开
-
树的存储结构(二叉树表示法)
#include<iostream> #include<algorithm> #include<queue> #include<stack> using namespace std; int cnt=0; typedef struct CSNode{ char data; struct CSNode *firstchild,*nextsibling; }CSNode,*CSTree; CSTree CreateCSTree(){ char ch; C原创 2021-12-12 16:46:26 · 578 阅读 · 0 评论 -
层序构造二叉树 c/c++
#include<iostream> #include<queue> #include<algorithm> using namespace std; const int maxn=1010; int i=1; char ch; typedef struct Node{ char val; struct Node *left; struct Node *right; }TreeNode,*BiTree; TreeNode *create(){ queue<原创 2021-12-12 16:37:53 · 788 阅读 · 0 评论 -
图(简单路径) c/c++
#include"邻接表存储结构.cpp" int len=0;//记录当前路径长度 int path[MAXVEX]; //bool visited[MAXVEX]; //创建邻接表 void Create(GraphAdjList &G){ int i,j,k; EdgeNode *p; printf("输入顶点数和边数:\n"); cin>>G.numVertexes>>G.numEdges; //输入顶点信息 pri原创 2021-12-09 19:00:21 · 1057 阅读 · 0 评论 -
邻接表建立无向图 c/c++
#include <stdio.h> #include <stdlib.h> #include<iostream> #define MAXVEX 20 typedef char VertexType; using namespace std; //边表结点 typedef struct EdgeNode{ int adjvex; struct EdgeNode *next; }EdgeNode; //顶点表结点 typedef struct Verte原创 2021-07-14 16:12:40 · 626 阅读 · 0 评论 -
图论:拓扑排序
拓扑排序:在图论中,由一个有向无环图的顶点组成的序列,当且仅当满足下列条件时,称为该图的一个拓扑排序。 1、每个顶点出现且只出现一次 2、若顶点A在序列中排在顶点B的前面,则在图中不存在从顶点B到顶点A的路径。 引言: #include"邻接表创建有向图.cpp" 这个邻接表创建有向图的cpp头文件,写法参考上篇博客 “邻接表建立无向图 c/c++” ,去掉建立边表的第二个头插法即可~ 链接: https://blog.youkuaiyun.com/m0_46229882/article/details/118.原创 2021-07-15 16:41:33 · 309 阅读 · 0 评论