数据结构与算法分析 c(习题)
文章平均质量分 51
zhenzhenjiajia888
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
3.2
#include #include using namespace std; typedef struct node { int num; struct node* pnext; }qnode,*pnode; pnode init(int n) { int i=n; int num_; pnode head,p,q; head=(pnode)ma原创 2016-08-28 21:22:21 · 334 阅读 · 0 评论 -
AVL树
树的高度与深度的差别:http://blog.youkuaiyun.com/fanpei_moukoy/article/details/23828603原创 2016-09-19 19:48:41 · 285 阅读 · 0 评论 -
3.21(双向栈)
因为top0和top1都指向最后一个元素的下一个位置,所以最好不要把数组占满,如存储6个数,最好开一个7个位置的数组。#include #include using namespace std; typedef struct stack { int* base; int top[2]; int size; }qstack,*pstack; void init(pstac原创 2016-08-30 15:32:00 · 763 阅读 · 0 评论 -
3.12(反转单结点)
#include #include #define MAX 5 using namespace std; typedef struct node { int num; struct node* pnext; }qnode,*pnode; pnode init() { pnode head; head=(pnode)malloc(sizeof(qnode));原创 2016-08-30 14:31:04 · 270 阅读 · 0 评论 -
3.15(自调整表)
数组实现 #include #include #define MAX 5 int k=0,t=0; using namespace std; typedef struct node { int* base; int lengh; int size; }qnode,*pnode; void init(pnode list) { list->base=(int*)原创 2016-08-30 14:03:36 · 1291 阅读 · 0 评论 -
基数排序(链表)
#include using namespace std; typedef struct Node { int data; struct Node *next; }LNode; void Initiate(LNode **head) { (*head)=(LNode*)malloc(sizeof(LNode)); (*head)->next=NULL; } v原创 2016-08-29 19:17:15 · 996 阅读 · 0 评论 -
3.11
#include #include #define MAX 8 using namespace std; typedef struct node { int num; struct node* pnext; }qnode,*pnode; pnode init() { int num_; int size=MAX; pnode head,p,q;原创 2016-08-29 12:51:21 · 359 阅读 · 0 评论 -
3.10
#include #include #define MAX 8 using namespace std; typedef struct node { int num; struct node* pnext; }qnode,*pnode; pnode init() { int num_; int size=MAX; pnode head,p,q;原创 2016-08-29 12:31:16 · 324 阅读 · 0 评论 -
3.6
#include #include #define MAX 5 using namespace std; typedef struct node { int num; int mi; struct node* pnext; }qnode,*pnode; pnode init() { int size=MAX,num_,mi_; pnode head,p,原创 2016-08-29 11:03:15 · 340 阅读 · 0 评论 -
3.4 3.5
#include #include #define MAX 5 using namespace std; typedef struct node { int* base; int lengh; int size; }qnode,*pnode; void init(qnode &head) { head.base=(int*)malloc(MAX*sizeof(i原创 2016-08-29 10:31:48 · 366 阅读 · 0 评论 -
3.3
——————————a———————— #include #include #define MAX 8 using namespace std; typedef struct node { int num; struct node* pnext; }qnode,*pnode; pnode init() { int i=MAX,num_; pnode head,原创 2016-08-29 09:52:57 · 379 阅读 · 0 评论 -
AVL树(平衡二叉查找树)
定义:AVL树是带有平衡条件的二叉查找树。这个平衡条件必须容易保持,最简单的想法是要求左右子树具有相同高度 旋转:为了使树保持平衡 不平衡的可能性 : 单旋转 双旋转 如何分辨单旋转还是双旋转并且进行旋转 首先要看插入数字后,它破坏的是哪个节点的平衡,如果破坏了的节点和沿着插入节点方向的节点,这被插入的节点的值在这两个节点的值之间,则为双旋转,否则是单旋转,如图,加入了原创 2016-09-20 19:56:48 · 414 阅读 · 0 评论
分享