![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法(C)
ThirteenL
这个作者很懒,什么都没留下…
展开
-
邻接表创建有向图
使用邻接表创建有向图,可以使用数组+链表的方式创建#include <iostream>using namespace std;//采用邻接表存储节点#define MaxSize 10// 定义边typedef struct arc_node { int adj_vex; //该边所指向节点的位置 struct arc_node *next_arc;} ArcNode;//定义顶点typedef struct vnode { char dat原创 2021-11-11 17:36:00 · 5270 阅读 · 3 评论 -
数据结构栈的基本操作实现(C语言实现)
栈的基本操作的实现栈:是一种受限的链表只允许在同一端插入(入栈:Push)和删除(出栈:Pop),所以栈遵循先进后出的原则#include <stdio.h>#include <stdlib.h>typedef int ElementType;typedef struct Node { ElementType element; struct Node *next;} Node, *Stack;//****************定义基本操作****原创 2020-10-08 19:59:25 · 528 阅读 · 0 评论 -
数据结构单链表的循环链表及基本操作实现(C语言实现)
循环链表的基本操作的实现特点:循环链表可以从任意一个位置循环遍历整个链表,如果设置的的为尾指针的话,其操作头节点后为节点的时间复杂度外O(1);其实现代码如下#include <stdio.h>#include <stdlib.h>#include <stdbool.h>typedef int ElementType;typedef struct Node { ElementType element; struct Node *next;原创 2020-09-16 17:24:42 · 490 阅读 · 0 评论 -
数据结构双向链表及基本操作实现(C语言实现)
双向链表基本操作的实现双向链表的特点:双向链表相对于单向链表其优点在于其可以同时查看某个节点的前驱节点和其后继节点,当然因为一个节点使用了两个指针来记录前后节点的位置,其每个节点占用的内存空间自然更大其实现的基本操作代码如下:#include <stdio.h>#include <stdlib.h>#include <stdbool.h>typedef int ElementType;typedef struct LNode { ElementT原创 2020-09-16 16:15:06 · 2577 阅读 · 0 评论 -
数据结构单链表及基本操作实现(C语言实现)
单链表的基本操作的实现定义(个人看法):单向链表是通过指针的方式将个各个节点串联起来形成链式结构;特点:具有插入和删除操作方便,但其访问链表中的元素没有顺序表快;#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <error.h>typedef int ElementType;typedef struct LNode *LinkList;struct LNod原创 2020-09-14 20:54:01 · 680 阅读 · 0 评论