自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

漫浸天空的雨色的备忘录~

————————————————————————来自一只程序员菜狗子最后的挣扎。。。 Σ(っ °Д °;)っ

  • 博客(90)
  • 资源 (12)
  • 收藏
  • 关注

原创 PAT 甲级 1148  Werewolf - Simple Version

1148Werewolf - Simple Version(20 point(s))Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game,player #1 sai...

2019-02-28 23:45:04 500

原创 PAT 甲级 1147  Heaps

1147Heaps(30 point(s))In computer science, aheapis a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either g...

2019-02-28 19:09:50 402

原创 PAT 甲级 1146  Topological Order

1146Topological Order(25 point(s))This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you a...

2019-02-28 18:36:09 893 4

原创 PAT 甲级 1145  Hashing - Average Search Time

1145Hashing - Average Search Time(25 point(s))The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of inte...

2019-02-28 17:39:29 508 4

原创 PAT 甲级 1144  The Missing Number

1144The Missing Number(20 point(s))Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test ...

2019-02-28 16:28:28 373

原创 PAT 甲级 1143  Lowest Common Ancestor

1143Lowest Common Ancestor(30 point(s))The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recu...

2019-02-28 13:14:01 482

原创 PAT 甲级 1142  Maximal Clique

1142Maximal Clique(25 point(s))Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be...

2019-02-28 12:08:35 515

原创 PAT 甲级 1141  PAT Ranking of Institutions

1141PAT Ranking of Institutions(25 point(s))After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rankli...

2019-02-28 10:27:54 409

原创 PAT 甲级 1140  Look-and-say Sequence

1140Look-and-say Sequence(20 point(s))Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...whereDis in [0, 9] except 1. The (n+1)st nu...

2019-02-28 09:56:31 397

原创 PAT 甲级 1139  First Contact

1139First Contact(30 point(s))Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would ...

2019-02-27 20:27:24 1192 2

原创 PAT 甲级 1138  Postorder Traversal

1138Postorder Traversal(25 point(s))Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the fi...

2019-02-27 18:23:57 386

原创 PAT 甲级 1137  Final Grading

1137Final Grading(25 point(s))For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first o...

2019-02-27 18:05:31 630

原创 PAT 甲级 1136  A Delayed Palindrome

1136 A Delayed Palindrome (20 point(s))Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ with 0≤a​i​​<10 for all i and a​k​​>0. Then N is pal...

2019-02-27 12:27:13 387

原创 PAT 甲级 1135  Is It A Red-Black Tree

1135 Is It A Red-Black Tree (30 point(s))There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red o...

2019-02-27 11:52:12 535

原创 PAT 甲级 1134  Vertex Cover

1134 Vertex Cover (25 point(s))A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex se...

2019-02-27 00:20:23 395

原创 PAT 甲级 1133  Splitting A Linked List

1133 Splitting A Linked List (25 point(s))Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the v...

2019-02-25 18:16:13 447

原创 PAT 甲级 1132  Cut Integer

1132 Cut Integer (20 point(s))Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 16...

2019-02-25 17:00:43 333

原创 PAT 甲级 1131  Subway Map

1131 Subway Map (30 point(s))In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are s...

2019-02-25 16:24:58 650

原创 PAT 甲级 1130  Infix Expression

1130 Infix Expression (25 point(s))Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operators.Input S...

2019-02-25 11:18:24 367

原创 PAT 甲级 1129  Recommendation System

1129 Recommendation System (25 point(s))Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates t...

2019-02-25 01:10:08 426

原创 PAT 甲级 1128  N Queens Puzzle

1128 N Queens Puzzle (20 point(s))The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires tha...

2019-02-24 23:31:33 429

原创 PAT 甲级 1127  ZigZagging on a Tree

1127 ZigZagging on a Tree (30 point(s))Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder trav...

2019-02-24 19:11:01 621 2

原创 PAT 甲级 1126  Eulerian Path

1126 Eulerian Path (25 point(s))In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends ...

2019-02-24 17:55:01 332 2

原创 PAT 甲级 1125  Chain the Ropes

1125 Chain the Ropes (25 point(s))Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as sho...

2019-02-24 17:14:42 284

原创 PAT 甲级 1124  Raffle for Weibo Followers

1124 Raffle for Weibo Followers (20 point(s))John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from eve...

2019-02-24 16:51:02 249

原创 PAT 甲级 1123  Is It a Complete AVL Tree

1123 Is It a Complete AVL Tree (30 point(s))An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any tim...

2019-02-24 12:19:13 414

原创 PAT 甲级 1122  Hamiltonian Cycle

1122 Hamiltonian Cycle (25 point(s))The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you ...

2019-02-24 11:12:47 365

原创 PAT 甲级 1121  Damn Single

1121 Damn Single (25 point(s))"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of....

2019-02-24 10:32:17 324

原创 PAT 甲级 1120  Friend Numbers

1120 Friend Numbers (20 point(s))Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers sin...

2019-02-24 09:51:48 302

原创 PAT 甲级 1119  Pre- and Post-order Traversals

1119 Pre- and Post-order Traversals (30 point(s))Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and in...

2019-02-24 09:42:39 456

原创 PAT 甲级 1118  Birds in Forest

1118 Birds in Forest (25 point(s))Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to h...

2019-02-23 23:17:31 371

原创 PAT 甲级 1117  Eddington Number

1117 Eddington Number (25 point(s))British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the max...

2019-02-23 22:28:42 384

原创 PAT 甲级 1116  Come on! Let's C

1116 Come on! Let's C (20 point(s))"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is ...

2019-02-23 18:23:11 272

原创 PAT 甲级 1115  Counting Nodes in a BST

1115 Counting Nodes in a BST (30 point(s))A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with ...

2019-02-23 18:10:33 364

原创 PAT 甲级 1114  Family Property

1114 Family Property (25 point(s))This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name...

2019-02-23 17:26:51 412

原创 PAT 甲级 1113  Integer Set Partition

1113 Integer Set Partition (25 point(s))Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A​1​​ and A​2​​ of n​1​​ and n​2​​ numbers, respectively...

2019-02-23 16:18:08 315

原创 PAT 甲级 1112  Stucked Keyboard

1112 Stucked Keyboard (20 point(s))On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on sc...

2019-02-23 12:22:07 401 2

原创 PAT 甲级 1111  Online Map

1111 Online Map (30 point(s))Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and th...

2019-02-23 11:18:30 441 4

原创 PAT 甲级 1110  Complete Binary Tree

1110 Complete Binary Tree (25 point(s))Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first...

2019-02-23 00:18:39 491 10

原创 PAT 甲级 1109  Group Photo

1109 Group Photo (25 point(s))Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: The number of people in each row must be N/K...

2019-02-22 22:51:18 385

晴神机试技巧讲解浓缩版

本资源仅为晴神所讲解的机试技巧个人整理浓缩版,仅供学习交流,请勿用作商业用途,侵权删。

2019-04-18

计算机专业基础综合考试真题思路分析2019

内含2009-2018 年的所有考试真题,是PDF,不是照片,仅供学习交流,请勿商业传播,侵权删。

2019-01-16

王道计算机网络2019考研指导书(无水印)

无水印,本资料仅供考研学子交流,请勿作为商业用途,侵权删。

2018-09-13

王道计算机组成原理2019考研指导书(无水印)

无水印,本资料仅供考研学子交流,请勿作为商业用途,侵权删。

2018-09-13

王道数据结构2019考研指导书(无水印)

无水印,本资料仅供考研学子交流,请勿作为商业用途,侵权删。

2018-09-13

王道操作系统2019考研指导书(无水印)

无水印,本资料仅供考研学子交流,请勿作为商业用途,侵权删。

2018-09-13

LL(1)文法的判别以及非LL(1)文法的转换(完整可运行代码)

本程序的所用的存储结构都是string类型的,最主要的存储文法的数据结构为自定义结构,里面包括一个产生式的左部,右部以及select集合,至于非终结符的first和follow集合,则是定义了一个string类型的数组进行存储。 本程序的求first,follow,select集合的算法即为书上所介绍的方法,即求first的集合时,只看本产生式,求follow集合时,要进行递归查找一个非终结符的所有后跟字符,求select其实就是对first与follow集合的运算,最终根据所有的select集合,便可以判断此文法是否为LL(1)文法。 对于不是LL(1)文法的产生式,本程序在判断后进行转换,先进行消除左递归,然后提取左公因子,在这两步的每一步结束之后,都要对产生式进行整合,去掉空存储,去掉无法到达的产生式,将select全部置空。 每进行一次非LL(1)到LL(1)的转换之后,都要对其文法性质进行判断,如果是LL(1),则跳出,不是则继续,但是当循环一定次数之后仍不是,程序判定其无法转换,也要跳出。 其中还有对第一个非终结字符的右部替换与否进行选择,原因是,有些通过替换就可以很方便的进行转换,这个要通过人为进行输入。 提取公因子中也有上一段所说的类似的判断机制,目的是为了防止文法的左公因子无法提取完的情况出现。 最终有三种结果,一种是是LL(1)文法,一种是不是LL(1),但是经过转换变成了LL(1),还有一种是经过转换也无法变成LL(1)。 输入文本格式样例: A A->ad A->Bc B->aA B->bB

2018-09-10

DFA的最小化 (完整可运行代码)

本程序的基本数据结构是string类型的数组,用于储存划分的子集,而子集中的元素的邻接点与权值都在edge结构体数组中存储。 把一个DFA的状态分成一些不相交的子集,使得任何不同的两子集的状态都是可区别的,而同一子集中的任何两个状态都是等价的. 算法假定每个状态射出的弧都是完全的,否则,引入一个新状态,叫死状态,该状态是非终态,将不完全的输入弧都射向该状态,对所有输入,该状态射出的弧还回到自己。 1.构造状态的一初始划分:终态kt 和非终态K- kt两组(group) 2.对∏施用过程PP 构造新划分∏new 3.如∏new =∏,则令 ∏final=∏ 并继续步骤4,否则∏:=∏ new重复2 . 4.为∏final中的每一组选一代表,这些代表构成M’的状态。若k是一代表且f(k,a)=t,令r是t组的代表,则M’中有一转 换f’(k,a)=rM’ 的开始状态是含有S0的那组的代表 M’ 的终态是含有F的那组的代表 5.去掉M’中的死状态. 输入文本格式样例: 0 a 1 1 a 2 2 a 2 2 d 3 1 d 3 3 d 3 3 a 2 # 123 0 ad

2018-09-10

NFA的确定化(NFA->DFA)(完整可运行代码)

本程序的目的数据结构是一个储存所有子集集合的一个结构体,包含子集中所有的状态,利用邻接表实现。 算法正如书上所说,子集构造算法如下: 假定所构造的子集族为C,即C= (T1, T2,,... TI),其中T1, T2,,... TI为状态K的子集。 (1)开始,令-closure(K0)为C中唯一成员,并且它是未被标记的。 (2)while (C中存在尚未被标记的子集T)do { 标记T; for 每个输入字母a do { U:= -closure(move(T,a)); if U不在C中 then 将U作为未标记的子集加在C中 } } 输入文本格式样例: A B C D E F G H I J K L M N O P Q R S T # A a B C * D E a F G d H M a N O d P Q * M Q * O N * R P * R I * E I * G F * J H * J K * I J * L J * I K * L B * S S * K S * C D * T R * T L * Q

2018-09-10

正规文法转正规式+正规式NFA(完整可运行代码)

(1)正规文法转正规式: 本程序的数据结构是string类的字符串存储变量,首先,读入的是3型文法,即正规文法,关于文法的检验这里就不再进行(因为第一个实验里已经实现了),读入的还有一个flag,flag为0即为左线性,为1为右线性,对读入的文法先进行第一次归类,即正规式左部相同的放在一起,本程序使用vector容器实现的对象放置,然后对所有的没有外部依赖的元素进行整合,最后依据没有外部依赖的整合后的表达式对其他的正规文法进行转换,最终得到转换结果。 (2)正规式NFA 本程序有很多数据结构,但最终的目的数据结构是存储转化好的NFA图的单元cell,里面包含起点、终点、边数以及边集合。 先读入正规式,并对正规式进行合法检测,将正规式中填入连接符号“+”,然后将其转化成后缀表达式,根据后缀表达式,对每一个操作符和操作数进行处理,处理的数据结构为cell类型的堆栈,处理完后,将最终栈内唯一的目的cell元素出栈,最后将其用二维数组的形式展现出来。 输入文件样例: a($|((a|d)(a|d)*))

2018-09-10

Chomsky文法类型判断(编译原理实验完整代码)

本程序的基本数据结构是一个字符型的二维数组。 先将文本文件一行一行的读入二维字符数组中,每一行只有一个产生式; 然后将二维数组中的每一行进行判断处理,先通过扫描找到每一行的推导符号“->”; 对“->”前面以及后面的字符分开进行处理,分别对其进行终结字符与非终结字符数量的统计; 比较产生式左部与右部所有的终结字符与非终结字符的数量,分别对不同的情况进行判断,将判断的结果保存在一个一位数组中(所有情况都不符合用-1标记); 对一维数组按从小到大的顺序进行冒泡排序,所以一位数组的第一个元素的大小即为此文法的类型,进行输出(-1则为不符合所有文法类型)。 输入文件格式样例: S->aA A->aB A->dB A-># B->aB B->dB B->#

2018-09-10

王道计算机考研机试指南(完整版)

众所周知,机试是计算机考研当中非常重要的一个环节。在越来越注重实践 动手能力的今天,越来越多的知名高校在计算机研究生招生考试当中采用了机试的形式,通过这种考试手段来考察考生分析问题并利用计算机程序解决问题的能力。通过机试,可以考察一个考生从实际问题当中抽象得出数学模型的能力,利用所学的计算机专业知识对该模型进行分析求解的能力,以及利用计算机编程语言,结合数据结构和算法真正解决该实际问题的能力。

2018-09-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除