随笔分类 -  MOOC数据结构源码

摘要:堆的定义与操作typedef struct HNode *Heap; /* 堆的类型定义 */struct HNode { ElementType *Data; /* 存储元素的数组 */ int Size; /* 堆中当前元素个数 */... 阅读全文
posted @ 2018-05-09 15:32 focus5679 阅读(240) 评论(0) 推荐(0)
摘要:AVL树的旋转与插入typedef struct AVLNode *Position;typedef Position AVLTree; /* AVL树类型 */struct AVLNode{ ElementType Data; /* 结点数据 */ AV... 阅读全文
posted @ 2018-05-09 15:31 focus5679 阅读(141) 评论(0) 推荐(0)
摘要:二叉搜索树的插入与删除BinTree Insert( BinTree BST, ElementType X ){ if( !BST ){ /* 若原树为空,生成并返回一个结点的二叉搜索树 */ BST = (BinTree)malloc(sizeo... 阅读全文
posted @ 2018-05-09 15:30 focus5679 阅读(740) 评论(0) 推荐(0)
摘要:递归实现void InorderTraversal( BinTree BT ){ if( BT ) { InorderTraversal( BT->Left ); /* 此处假设对BT结点的访问就是打印数据 */ pri... 阅读全文
posted @ 2018-05-09 15:28 focus5679 阅读(131) 评论(0) 推荐(0)
摘要:队列的定义与操作-顺序存储typedef int Position;struct QNode { ElementType *Data; /* 存储元素的数组 */ Position Front, Rear; /* 队列的头、尾指针 */ i... 阅读全文
posted @ 2018-05-09 15:26 focus5679 阅读(253) 评论(0) 推荐(0)
摘要:堆栈的定义与操作-顺序存储typedef int Position;struct SNode { ElementType *Data; /* 存储元素的数组 */ Position Top; /* 栈顶指针 */ int MaxSize; ... 阅读全文
posted @ 2018-05-09 15:24 focus5679 阅读(506) 评论(0) 推荐(0)
摘要:线性表的定义与操作-顺序表typedef int Position;typedef struct LNode *List;struct LNode { ElementType Data[MAXSIZE]; Position Last;}; /* 初始化 *... 阅读全文
posted @ 2018-05-09 15:21 focus5679 阅读(135) 评论(0) 推荐(0)