数据结构
文章平均质量分 77
AHU_Tree
这个作者很懒,什么都没留下…
展开
-
HDU1166 敌兵布阵(线段树)
Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视原创 2014-02-28 16:43:03 · 801 阅读 · 0 评论 -
数据结构---队列的链式实现
其实理解了一个数据结构后,它的各种实现与操作就能很容易的写出来 话说貌似下周数据结构有其中考试...Orz我翘了两次课 串和数组那地方还不太懂 要跪啊.... #include #include typedef int ElemType; typedef struct Node { ElemType Data; struct Node *Next; }Node, *PtrNode;原创 2015-04-16 15:08:23 · 590 阅读 · 0 评论 -
数据结构---栈的链式实现
链栈和链表的实现方式大致相同,只是链栈只能在头部操作。 #include #include typedef int ElemType; typedef struct Node { ElemType Data; struct Node * Next; }Node; typedef struct { Node *Base; Node *Top; }Stack, *Link原创 2015-04-13 19:30:59 · 485 阅读 · 0 评论 -
数据结构---栈的顺序实现
栈是一种LIFO表,即后进先出表,可以把栈理解为 火车调度时的情况。先进入一节车厢,记为1,再进入一节车厢,记为2,。1想要出站,必须2先出站。也可以理解为洗盘子的情形,洗完一个盘子后放在最下方,再洗一个放在上一个盘子的上方,最后需要取用盘子的时候就从最上面的一个取。 #include #include #define STACK_INIT_SIZE 20 typedef int E原创 2015-04-12 19:38:57 · 776 阅读 · 0 评论 -
数据结构---线性表的链式实现
链表的实现和基本操作 请忽略注释的中式英语。。。。。。。_(:з」∠)_ #include #include typedef int ElementType; typedef struct Node { ElementType *Data; struct Node *Next; }Node ,*LinkList; //creat an empty List with hea原创 2015-04-09 13:39:19 · 475 阅读 · 0 评论 -
数据结构---串的定长顺序实现
计算机经常处理字符串类型数据,所以需要用一种数据结构来定义它。话术我感觉JAVA等高级语言封装后的字符串比较好用..C里面好多操作还需要自己来实现Orz #include #include #include #define MAXSTRLEN 255 typedef unsigned char SString[MAXSTRLEN + 1]; typedef unsigned ch原创 2015-04-18 10:50:41 · 818 阅读 · 0 评论 -
数据结构---线性表的顺序实现
写了构造空表、添加、删除、查找等操作,大部分功能都实现了 ,如果有代码写错的地方欢迎交流 //线性表顺序实现 #include #include //线性表初始大小 #define LIST_INIT_SIZE 100 //默认数据类型为int 可修改 typedef int ElementType; //线性表结构体 typedef struct List { Elemen原创 2015-04-03 21:30:07 · 556 阅读 · 0 评论 -
POJ2828 Buy Tickets(线段树)
Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue… The Lunar New Year was approaching, but unluckily the Little Ca原创 2014-03-06 12:06:33 · 754 阅读 · 0 评论 -
HDU2795 Billboard(线段树)
Problem Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcement原创 2014-03-05 11:39:46 · 765 阅读 · 0 评论 -
HDU1394 Minimum Inversion Number(线段树)
Problem Description The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we mov原创 2014-03-03 22:44:00 · 801 阅读 · 0 评论 -
AOJ558 窃取任务
Description 战争期间,双方互打信息战,我军准备去敌方一条战斗主线上的信息塔窃取他们的信息。敌方的信息塔排成了一条线,每个信息塔都会同时向两侧(两端的塔只向一侧)严格比自己高的最近的信息塔传送信息。现在时间紧迫,我们只能去其中一个信息塔,为了最高效的窃取敌人的信息,我们必须选择其中信息接收量最大的塔。现在请你去执行这个窃取任务。 Input 第1行,一个整数N(1第2行,N个原创 2014-02-26 14:05:54 · 958 阅读 · 0 评论 -
HDU1754 I Hate It(线段树)
Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N原创 2014-02-28 20:35:53 · 659 阅读 · 0 评论 -
数据结构---队列的顺序实现
可以把队列想象成排队情况,只允许从队尾开始插入,队头删除 #include #include #define MAX_QUEUE_SIZE 100 typedef int ElemType; typedef struct Queue { ElemType *Base; ElemType Rear; ElemType Front; }Queue, *PtrQueue; //原创 2015-04-15 15:36:29 · 515 阅读 · 0 评论