TsinghuaX: 数据结构(2015)
walker lee
这个作者很懒,什么都没留下…
展开
-
THU2015 fall 1-2 Company
THU2015 fall 1-2 Company描述 公司有n个员工,编号1 ~ n。员工数量众多,需要你为他们编写一个管理系统。 员工上班时都要登录管理系统登记一个code,离开要从管理系统上注销,员工也可以随时更新自己的code。到了下班时间,所有员工都会自动注销。公司管理人员随时都可能想要知道有多少员工上班,以及任一员工登记的code。输入原创 2015-11-05 10:26:40 · 2330 阅读 · 0 评论 -
Tsinghua OJ:范围查询(Range)
范围查询(Range)DescriptioinLet S be a set of n integral points on the x-axis. For each given interval [a, b], you are asked to count the points lying inside.InputThe first line con原创 2015-10-18 20:15:06 · 4074 阅读 · 8 评论 -
Tsinghua OJ:列车调度(Train)
列车调度(Train)DescriptionFigure 1 shows the structure of a station for train dispatching.Figure 1In this station, A is the entrance for each train and B is the exit. S is the transfer原创 2015-10-20 11:21:12 · 5524 阅读 · 2 评论 -
Tsinghua OJ:真二叉树重构(Proper Rebuild)
真二叉树重构(Proper Rebuild)DescriptionIn general, given the preorder traversal sequence and postorder traversal sequence of a binary tree, we cannot determine the binary tree.Figure 1In原创 2015-11-05 09:51:18 · 4081 阅读 · 0 评论 -
Tsinghua OJ:灯塔(LightHouse)
灯塔(LightHouse)DescriptionAs shown in the following figure, If another lighthouse is in gray area, they can beacon each other.For example, in following figure, (B, R) is a pair of lighthouse which can ...原创 2015-10-19 16:24:58 · 4948 阅读 · 0 评论 -
Tsinghua OJ:隧道(Tunel)
隧道(Tunel)DescriptionA tunnel is single and one-way. Each vehicle can only enter the tunnel at one end and exit it at the other end. Overtaking is not allowed. The tunnel has the limitati原创 2015-11-03 16:58:10 · 984 阅读 · 0 评论 -
Tsinghua OJ:祖玛(Zuma)
祖玛(Zuma)DescriptionLet's play the game Zuma!There are a sequence of beads on a track at the right beginning. All the beads are colored but no three adjacent ones are allowed to be with原创 2015-10-18 20:31:28 · 4425 阅读 · 0 评论 -
THU2015 fall 2-3 Rebuild
THU2015 fall 2-3 Rebuild描述某二叉树的n个节点已经用[1, n]内的整数进行了编号。现给定该二叉树的先序遍历序列和中序遍历序列,试输出其对应的后序遍历序列。输入第一行为一个数n。第二、三行,即已知的先序、中序遍历序列,数字之间以空格分隔。输出仅一行。若所给的先序、中续遍历序列的确对应于某棵二叉树,则原创 2015-11-05 10:12:36 · 1112 阅读 · 0 评论 -
THU2015 fall 1-3 Interview
THU2015 fall 1-3 Interview描述 某公司在对应聘者做过一轮笔试之后,从中选出n 人继续进行面试,每位应聘者被分配了一个整数ID。 为公平起见,组织者决定利用会议室外的圆桌,按以下方法“随机”确定面试顺序:第一个到达的应聘者在圆桌周围任意选择一个位置坐下;此后到达的每位应聘者都从前一应聘者出发,沿逆时针方向围圆桌走过m 人(前一应聘者算作走原创 2015-11-05 10:24:18 · 1731 阅读 · 0 评论 -
THU2015 fall 2-4 Queap
THU2015 fall 2-4 Queap描述通过扩展已实现的基本数据结构,模拟更为复杂的数据结构,是一种常见而实用的技巧。这里,我们将利用栈结构,来模拟一种功能增强的队列。具体来说,你必须首先实现一个元素类型为int的栈,该栈能且只能支持以下操作接口:bool empty(); //判断是否栈空void push(int); //向栈中压入一个整数i原创 2015-11-05 10:02:41 · 3823 阅读 · 0 评论 -
THU2015 fall 2-2 Train
THU2015 fall 2-2 Train描述某列车调度站的铁道联接结构如图所示。其中,A为入口,B为出口,S为中转盲端。所有铁道均为单轨单向式:列车行驶的方向只能是从A到S,再从S到B;另外,不允许超车。因为车厢可在S中驻留,所以它们从B端驶出的次序,可能与从A端驶入的次序不同。不过S的容量有限,同时驻留的车厢不得超过m节。设某列车由编号依次为{1, 2原创 2015-11-05 10:17:43 · 1026 阅读 · 2 评论