coderLucas

Miracles happen every day.
摘要: 1)存储类型: 标准C语言为变量,常量和函数定义了4种存储类型:extern,auto,static,register. 这4种存储类型可分为两种生存期限:永久的(在整个程序执行期都存在)和临时的(暂时保存在堆栈和寄存器中). extern和static用来标识永久生存期限的"变量和函数",而ant... 阅读全文
posted @ 2014-05-06 19:03 lucas hsueh 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 度:结点拥有的子树数目。 树的度:各结点度的最大值。 树的深度(高度):树中结点的最大层次(根为第一层) 二、树的存储结构 顺序存储:双亲表示法 链式存储:1.孩子表示法 2.孩子兄弟表示法(第一个孩子、右兄弟) 三、二叉树 1.二叉树的性质 (1)第i层最多2^(i-1)个结点 (2)深度为k的二叉树最... 阅读全文
posted @ 2014-05-06 15:24 lucas hsueh 阅读(322) 评论(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 阅读(238) 评论(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 阅读(168) 评论(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 阅读(177) 评论(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 阅读(231) 评论(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 阅读(391) 评论(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 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 1、栈区(stack):由编译器自动分配和释放 ,存放函数的参数值、局部变量的值等,甚至函数的调用过程都是用栈来完成。其操作方式类似于数据结构中的栈。2、堆区(heap) :一般由程序员手动申请以及释放, 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式类似于链表... 阅读全文
posted @ 2014-05-06 11:56 lucas hsueh 阅读(198) 评论(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 阅读(251) 评论(0) 推荐(0) 编辑