数据结构
chenshida_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
简单图和多重图
一、简单图 ① 不存在重复边; ② 不存在顶点到自身的边; 二、多重图 ① 某两结点之间边数多于一条; ② 允许顶点通过一条边和自己关联;转载 2021-12-15 12:36:33 · 4364 阅读 · 0 评论 -
数据结构(七)图的遍历(递归非递归方法)
图的遍历(递归非递归方法) #include<iostream> #include<stdio.h> #include<stack> #include<queue> using namespace std; typedef char VertexType; typedef int EdgeType; #define MAXVEX 100 #define INF 65535 bool visited[MAXVEX] ; typedef struct Gra原创 2021-12-15 12:26:20 · 1900 阅读 · 0 评论 -
数据结构(六)二叉树的遍历(递归非递归方法)
数据结构(六)二叉树的遍历(递归非递归方法) 一、递归方法 1.先序遍历 void PreOrder(BiTree T) { visit(T); PreOrder(T->LChild) PreOrder(T->RChild) } 2.先序遍历 void PreOrder(BiTree T) { PreOrder(T->LChild) visit(T); PreOrder(T->RChild) } 3.先序遍历 void PreOrder(BiTree T) {原创 2021-08-16 11:08:52 · 192 阅读 · 0 评论 -
数据结构(五)层次遍历
数据结构(五)层次遍历 // linear_listqueue.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <stdlib.h> #include <stdio.h> #define ElemType BiTree using namespace std; typedef str原创 2021-03-23 11:25:32 · 909 阅读 · 0 评论 -
数据结构(五)树
数据结构(五)树一、基本操作 树是n个节点的有限集,它是一种递归的数据结构 一、基本操作 #include <stdio.h> #include <stdlib.h> #include <iostream> #define Elemtype char using namespace std; typedef struct BiTNode { Elemtype data; struct BiTNode* lchild, * rchild; }BitT原创 2021-03-23 10:38:04 · 159 阅读 · 0 评论 -
数据结构(四)串的动态数组存储
#include <stdio.h> #include <stdlib.h> #define MAXLEN 255 //定长顺序存储 typedef struct { char* ch; //每个分量存储一个字符 int length; //串的实际长度 }SString; //串的初始化 bool StrAssign(SString& T, char* chars) { int i = 0, len; T.ch = (char*)ma原创 2021-03-16 23:04:28 · 739 阅读 · 1 评论 -
数据结构(四)串的顺序存储
#include <stdio.h> #include <stdlib.h> #define MAXLEN 255 //定长顺序存储 typedef struct { char ch[MAXLEN]; //每个分量存储一个字符 int length; //串的实际长度 }SString; //串的初始化 bool StrAssign(SString& T, char* chars) { int i = 0, len; char* p;原创 2021-03-16 08:05:41 · 251 阅读 · 0 评论 -
数据结构(三)队列
数据结构(三)队列队列队列(顺序存储)循环队列(顺序存储)队列(链式存储) 队列 队列是一种受限制的线性表,只允许表的一端插入,在表的另一端删除 队列(顺序存储) // linear_Queue.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <stdio.h> #include <std原创 2021-03-13 13:49:06 · 271 阅读 · 0 评论 -
数据结构(二)栈
栈一、栈顺序栈线性栈(不带头结点)线性栈(带头结点) 一、栈 栈是只允许在一端进行插入或删除操作的线性表。 栈顶:线性表允许进行插入删除的那一端 栈底:固定的,不允许进行插入和删除的那一端 空栈:不含如何元素的空表 顺序栈 // linear_stack.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include原创 2021-03-08 22:02:51 · 301 阅读 · 0 评论 -
数据结构(一)线性表
数据结构(一)线性表一、线性表定义二、顺序表定义动态数组三、单链表定义不带头结点带头结点头结点与不带头结点的区别头插法与尾插法双链表循环链表循环单链表循环双链表静态链表 一、线性表定义 线性表是具有相同数据类型的n个数据元素的有限序列 特点: 表中的元数的个数有限 表中具有逻辑上的顺序性,表中元素有其先后次序 表中元素都是数据元素,每个元素都是单个元素 表中元素的数据类型都相同,这意味着每个元素占有相同大小的存储空间 二、顺序表 定义 线性表的顺序存储称为顺序表。逻辑上相邻的元素物理空间上也相邻 特点:原创 2021-03-02 13:19:15 · 191 阅读 · 0 评论
分享