
数据结构课
QingQingDE23
这个作者很懒,什么都没留下…
展开
-
数据结构课--排序算法(插入、希尔、冒泡、快速、选择、堆、归并)
#include<bits/stdc++.h>using namespace std;void menu(){ cout<<"请选择你需要的功能:"<<endl; cout<<"1.插入排序"<<endl; cout<<"2.希尔排序"<<endl; cout<<"3.冒泡排序"<<endl; cout<<"4.快速排序"<<endl; cout<&l原创 2021-12-28 23:33:47 · 667 阅读 · 0 评论 -
数据结构-查找
#include<bits/stdc++.h>using namespace std;typedef struct BSTNode{ int data; BSTNode *lchild; BSTNode *rchild;}BSTNode, *BSTree; bool Search(BSTree bst, int k, BSTree f, BSTree *p){//查找成功时,p指向值为k的节点,查找失败时,则p指向遍历的最后一个节点 if(!bst){ *p = f原创 2021-12-19 11:26:02 · 321 阅读 · 0 评论 -
数据结构-图的遍历
#include<bits/stdc++.h>using namespace std;typedef int VertexType;typedef int EdgeType;#define MAXSIZE 20#define MAXEDGE 20#define MAXVEX 20#define INF 0x3f3f3ftypedef struct{ VertexType vex[MAXVEX];//定点 EdgeType edg[MAXVEX][MAXVEX];//原创 2021-12-12 21:48:12 · 384 阅读 · 0 评论 -
数据结构-哈夫曼树
#include<iostream>#include<cstring>using namespace std; #define OK 1#define ERROR 0#define SIZE 27typedef bool Status;typedef struct { char code; unsigned int weight; unsigned int parent,lchild,rchild;}HTNode,*HuffmanTree;typed原创 2021-12-11 11:58:37 · 93 阅读 · 0 评论 -
数据结构—二叉树的基本操作
#include<iostream>#include<algorithm>#include<stack>#include<queue>#include<cstring>using namespace std;typedef char TElemType;typedef bool Status;typedef struct Tree{ TElemType Data; struct Tree * lchild, * rchil原创 2021-12-02 17:40:04 · 486 阅读 · 0 评论 -
数据结构—链队列
#include<iostream>#include<algorithm>using namespace std;typedef int QElemType; typedef bool Status; typedef struct QNode{ QElemType data; struct QNode *next;}QNode, *QueuePtr;typedef struct { QueuePtr front; QueuePtr rear原创 2021-11-11 11:28:37 · 548 阅读 · 0 评论 -
数据结构—矩阵的转置、快速转置
#include<iostream>#include<algorithm>using namespace std;#define MaxSize 12500#define Col 30#define Row 30typedef bool Status; bool t[1250][1250];//标记,避免重复输入typedef struct{//稀疏矩阵三元表定义 int i, j; int e;}Triple;typedef struct{.原创 2021-11-11 11:27:16 · 1316 阅读 · 0 评论 -
顺序栈及栈的一些基本操作 模板
#include<iostream>#include<stdio.h>#include<stdlib.h>using namespace std;typedef int SElemType;typedef int Status;#define STACK_INIT_SIZE 100 #define INCREAMENT 10#define OVERFLOW -1typedef struct{ SElemType *base; SElemType原创 2021-10-26 14:06:34 · 82 阅读 · 0 评论 -
双链表的基本功能实现
//双链表 #include<iostream>#include<stdio.h>#include<cstdlib>using namespace std;#define TRUE 1#define FALSE 0typedef int ElemType;typedef bool Status;typedef struct LNode{ struct LNode *next; struct LNode *pre; int data; }L原创 2021-10-16 11:45:38 · 134 阅读 · 0 评论 -
顺序表的基础功能实现
#include<stdio.h>#include<iostream>#include<cstdlib>using namespace std;#define List_init_size 100#define Listincreament 10#define ElemType int#define Status bool typedef struct{ ElemType *elem;//储存空间地址 int data;//节点数据 in原创 2021-10-03 18:01:16 · 128 阅读 · 0 评论