coderLucas

Miracles happen every day.
摘要: 一、基本概念 度:结点拥有的子树数目。 树的度:各结点度的最大值。 树的深度(高度):树中结点的最大层次(根为第一层) 二、树的存储结构 顺序存储:双亲表示法 链式存储:1.孩子表示法 2.孩子兄弟表示法(第一个孩子、右兄弟) 三、二叉树 1.二叉树的性质 (1)第i层最多2^(i-1)个结点 (2)深度为k的二叉树最... 阅读全文
posted @ 2014-05-06 15:24 lucas hsueh 阅读(339) 评论(0) 推荐(0)
摘要: 1: //sqqueue.cpp 2: 3: #include "sqqueue.h" 4: 5: SqQueue::SqQueue() 6: { 7: front = 0; 8: rear = 0; 9: } 10: 11: SqQueue::~SqQueue() 12: { 13: 14: } 15: 16: void SqQueue::ClearQue... 阅读全文
posted @ 2014-05-06 13:33 lucas hsueh 阅读(257) 评论(0) 推荐(0)
摘要: 1: //queue.cpp 2: 3: #include "queue.h" 4: 5: Queue::Queue() 6: { 7: front = new Node; 8: rear = new Node; 9: front->next = NULL; 10: rear = front; 11: length = 0; 12: } 13: 14:... 阅读全文
posted @ 2014-05-06 13:32 lucas hsueh 阅读(174) 评论(0) 推荐(0)
摘要: 1: //linkstack.cpp 2: 3: #ifndef LINKSTACK_CPP_CPP 4: #define LINKSTACK_CPP_CPP 5: 6: #include 7: #include "linkstack.h" 8: 9: template 10: LinkStack::LinkStack() 11: { 12: head = new ... 阅读全文
posted @ 2014-05-06 13:31 lucas hsueh 阅读(186) 评论(0) 推荐(0)
摘要: 1: //sqstack.cpp 2: #ifndef SQSTACK_CPP_CPP 3: #define SQSTACK_CPP_CPP 4: 5: #include "sqstack.h" 6: #include 7: 8: template 9: SqStack::SqStack(): 10: top(-1),maxsize(MAXSIZE) 11: { 12: ... 阅读全文
posted @ 2014-05-06 13:30 lucas hsueh 阅读(252) 评论(0) 推荐(0)
摘要: 需要注意的问题:类模板无法分开链接问题。 类模板在编译的时候没有错误,但是在链接过程中会报错 error LNK2019: unresolved external symbol "public: __thiscall LinkList::~LinkList(void)" (??1?$LinkList@H@@QAE@XZ) referenced in function _main 这是由于类模... 阅读全文
posted @ 2014-05-06 13:29 lucas hsueh 阅读(401) 评论(0) 推荐(0)
摘要: 1: //sqlist.cpp 2: #include "sqlist.h" 3: #include 4: 5: void SqList::InitList() 6: { 7: length = 0; 8: } 9: 10: bool SqList::ListEmpty() 11: { 12: return (0 == length); 13: } 14: 1... 阅读全文
posted @ 2014-05-06 13:26 lucas hsueh 阅读(249) 评论(0) 推荐(0)
摘要: 一、简单模式匹配算法(略,逐字符比较即可)二、KMP模式匹配算法next数组:j为字符序号,从1开始。(1)当j=1时,next=0;(2)当存在前缀=后缀情况,next=相同字符数+1;(3)当前缀 != 后缀且j != 1时,next=1。如下: abcdexnext=011111 abcabx... 阅读全文
posted @ 2014-05-06 11:26 lucas hsueh 阅读(276) 评论(0) 推荐(0)