
数据结构
文章平均质量分 81
万木春《Linux 后端开发工程实践》
这个作者很懒,什么都没留下…
展开
-
单链表(link list)
<br />/* Author: ACb0y Date: 2010-6-11 Description: link list*/#include <stdio.h>#include <malloc.h>typedef int elemtype;struct node { elemtype data; node * pnext;};typedef struct { node * head; int length;}link_list;原创 2010-06-12 13:35:00 · 888 阅读 · 0 评论 -
顺序表(sequence list)
/* Author: ACb0y Date: 2010-6-11 Description: sequen_list Version: 1.1*/#include #define MAXSIZE 1 length = 0;}/* FUNCTION sequen_list_len原创 2010-06-11 20:22:00 · 1575 阅读 · 0 评论 -
循环单链表(circular list)
<br />#include <stdio.h>#include <malloc.h>typedef int elemtype;struct node { elemtype data; node * pnext;};typedef struct { node * head; int length;}circular_list;/* FUNCTION circular_list_create DESCRIPTION ini原创 2010-06-14 14:27:00 · 1035 阅读 · 0 评论 -
顺序栈(sequence stack)
<br />#include <stdio.h>#define MAXSIZE 1 << 10typedef int elemtype;typedef struct { elemtype data[MAXSIZE]; int top;}seqstack;/* FUNCTION seqstack_init DESCRIPTION initialize the sequence stack PARAMETERS p_seq_s: the poi原创 2010-06-14 16:19:00 · 969 阅读 · 0 评论 -
链栈(link stack)
<br />/* Author: ACb0y Date: 2010-6-14 Description: link stack */#include <stdio.h>#include <malloc.h>typedef int elemtype;typedef struct node { elemtype data; node * pnext;}link_stack;/* FUNCTION link_stack_create DESC原创 2010-06-14 17:18:00 · 936 阅读 · 0 评论 -
顺序队列(sequence queue)
<br />/* Author: ACb0y Date: 2010-6-14 Description: sequence queue */#include <stdio.h>#define MAXSIZE 100typedef int elemtype;typedef struct { elemtype queue[MAXSIZE]; int front; int rear;}sequeue;/* FUNCTION sequeue_i原创 2010-06-14 22:12:00 · 1949 阅读 · 0 评论 -
HDU 1305 Immediate Decodability(二叉树)
<br />题意:<br /> 给一系列的01串A{str[0], str[1], str[2], ...},判断是否存在str[i]是str[j]的前缀的情况。<br />解法:<br /> 使用二叉树,按照顺序把每个串插入二叉树中,如果在插入的过程中发现经过的节点是叶子节点这说明存在前缀的情况。<br /> <br />AC代码如下:<br />/* Author: ACb0y Date: 2010年12月4日19:36:36 ProblemID: HDU 1305原创 2010-12-04 19:44:00 · 1469 阅读 · 0 评论 -
HDU 1075 What Are You Talking About
<br />题意:<br /> 给一个映射的字典,然后给加密后的文本,求根据给定的映射的字典还原文本。<br />解法:<br /> 其实用STL的map就可以了,但这里我用了Tire tree弄了个伪map<br />AC代码如下:<br />/* Author: ACb0y Date: 2010年12月4日20:39:40 Type: Map, Tire tree ProblemID: 1075 HDU What Are You Talking About Resu原创 2010-12-04 21:15:00 · 1438 阅读 · 0 评论 -
HDU 1671 Phone list (Tire tree)
<br />题意:<br /> 给定一个电话列表,判断是否出现一个号码是另一个号码前缀的情况,如果有输出“NO”否则输出“YES”<br />解法:<br /> 字典树<br />没有考虑到的情况:<br /> 给定的电话号码系列不适字典序的,如果前缀号码出现在后面,这程序判断失误。<br />如:<br /> 911<br /> 911123<br />对于这组数据可以得到正确的答案<br /> 911123<br /> 911<br />对于这组数据就判断失原创 2010-12-05 16:33:00 · 1027 阅读 · 0 评论