![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构学习
文章平均质量分 67
那必是我阿钟
这个作者很懒,什么都没留下…
展开
-
链表解决荷兰国旗问题
以下采用尾插入法建立链表分别将L中的节点分配给L、L1、L2最后将三个链表再串起来原创 2018-12-19 22:50:50 · 620 阅读 · 0 评论 -
稀疏矩阵三元组乘法
#include #include <stdlib.h>using namespace std;#define MaxSize 100int M,N;typedef struct{int r;int c;int d; //元素值}TupNode; //三元组定义typedef struct{int rows;int co...原创 2018-12-24 23:38:36 · 1024 阅读 · 0 评论 -
二叉树链式
include#include <stdlib.h>using namespace std;#define MaxSize 100typedef struct node{char data;struct node *lchild,*rchild;}BTNode;void CreatBTBode(BTNode *&b,char *str){BTNode *S...原创 2018-12-24 23:33:48 · 166 阅读 · 0 评论 -
希尔排序
#include using namespace std;void Hell(int arr[],int n){//gap为一个增量,增量的求法为:数组的长度除以2,得到一个gap值,然后再用gap除以2,直到为1,这几个结果//称为增量(如果结果为小数,则向下取整,增量也是步长)for (int gap = n / 2; gap &gt;= 1; gap = gap / 2){//...原创 2018-12-28 17:57:16 · 96 阅读 · 0 评论 -
基数排序
#include using namespace std;int getMax(int num[], int n) //返回num数组中最大的一个{int i, max;max=num[0];for(i=1;i&lt;n;i++)if (num[i]&gt;max)max=num[i];return max;}void countSort(int num[], int n, ...原创 2018-12-28 14:59:37 · 91 阅读 · 0 评论 -
顺序表解决荷兰国旗问题
- 顺序表解决荷兰国旗问题,设有一个条块序列,每个条块为红(0)、白(1)、兰(2)三种颜色的一种。假设该序列采用顺序表存储,设计一个时间复杂度为O(n)的算法,使得这些条块按红、白、兰的顺序排好。![(https://img-blog.csdnimg.cn/20181219221207289.PNG?x-oss-process=image/watermark,type_ZmFuZ3poZW5n...原创 2018-12-20 21:02:22 · 1148 阅读 · 0 评论 -
栈的概念
栈的特点,后进先出。也称为后进先出表。栈的基本运算:InitStack(&amp;amp;s):DestroyStack(&amp;amp;s):StackEmpty(s):Push(&amp;amp;s,e):Pop(&amp;amp;s,&amp;amp;e):GetTop(s,&amp;amp;e):与线性表的逻辑关系相同,栈可以采用顺序栈或者链栈。#define M原创 2018-12-20 21:01:23 · 139 阅读 · 0 评论 -
双向链表建立并输出
#include #include &lt;stdlib.h&gt;using namespace std;#define Maxsize 100typedef struct DNode{int data;struct DNode *prior;struct DNode *next;}DLinkList;void CreatListF(DLinkList *&amp;L,int...原创 2018-12-20 21:02:10 · 502 阅读 · 0 评论 -
链表建立
#include #include&amp;amp;amp;amp;amp;amp;amp;amp;lt;stdlib.h&amp;amp;amp;amp;amp;amp;amp;amp;gt;using namespace std;typedef struct LNode{int data;struct LNode *next;}LinkList;void CreateListF(LinkList *&amp;amp;amp;原创 2018-12-20 21:02:01 · 119 阅读 · 0 评论 -
表的创建 邻接矩阵邻接表
#include using namespace std;//邻接矩阵#define MAXVtypedef int VertexType;typedef struct VertexType; //头顶点{int no;InfoType info;};typedef struct MGraph //邻接矩阵类型 适合存储图的稀疏矩阵{int edges[MAXV][MA...原创 2019-03-19 22:17:20 · 121 阅读 · 0 评论