06 2019 档案

摘要:Source: PAT A1020 Tree Traversals (25 分) Description: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder a 阅读全文
posted @ 2019-06-30 14:52 林東雨 阅读(142) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1086 Tree Traversals Again (25 分) Description: An inorder binary tree traversal can be implemented in a non-recursive way with a stack. F 阅读全文
posted @ 2019-06-30 14:40 林東雨 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1102 Invert a Binary Tree (25 分) Description: The following is from Max Howell @twitter: Now it's your turn to prove that YOU CAN invert 阅读全文
posted @ 2019-06-30 14:12 林東雨 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1004 Counting Leaves (30 分) Description: A family hierarchy is usually presented by a pedigree tree. Your job is to count those family me 阅读全文
posted @ 2019-06-28 16:52 林東雨 阅读(234) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1053 Path of Equal Weight (30 分) Description: Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​. 阅读全文
posted @ 2019-06-28 16:30 林東雨 阅读(205) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1079 Total Sales of Supply Chain (25 分) Description: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商) 阅读全文
posted @ 2019-06-28 15:56 林東雨 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1090 Highest Price in Supply Chain (25 分) Description: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应 阅读全文
posted @ 2019-06-28 15:38 林東雨 阅读(175) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1094 The Largest Generation (25 分) Description: A family hierarchy is usually presented by a pedigree tree where all the nodes on the sam 阅读全文
posted @ 2019-06-28 15:10 林東雨 阅读(193) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1106 Lowest Price in Supply Chain (25 分) Description: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商 阅读全文
posted @ 2019-06-28 14:43 林東雨 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-28 13:51:23 二叉树的建立 注意一下中序和层序建树 二叉树的遍历 多叉树的静态表示 阅读全文
posted @ 2019-06-28 14:07 林東雨 阅读(1299) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1043 Is It a Binary Search Tree (25 分) Description: A Binary Search Tree (BST) is recursively defined as a binary tree which has the foll 阅读全文
posted @ 2019-06-26 17:25 林東雨 阅读(179) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1064 Complete Binary Search Tree (30 分) Description: A Binary Search Tree (BST) is recursively defined as a binary tree which has the fol 阅读全文
posted @ 2019-06-26 16:48 林東雨 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1099 Build A Binary Search Tree (30 分) Description: A Binary Search Tree (BST) is recursively defined as a binary tree which has the foll 阅读全文
posted @ 2019-06-26 16:26 林東雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Source: PAT (Advanced Level) Practice Reference: [1]胡凡,曾磊.算法笔记[M].机械工业出版社.2016.7 Outline: 基础数据结构: 线性表:栈,队列,链表,顺序表 树:二叉树的建立和遍历,完全二叉树,二叉查找树,平衡二叉树,堆,哈夫曼树 阅读全文
posted @ 2019-06-25 17:49 林東雨 阅读(1106) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-25 14:40:32 基本操作 注意:数据量较大时,插入建树的时间复杂度会很高,慎用! 删除优化 删除操作中,找到替换结点后,该结点就是接下来需要删除的结点,直接删除即可 目前PAT考试中还没有考察过删除结点相关的算法 阅读全文
posted @ 2019-06-25 14:48 林東雨 阅读(287) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1133 Splitting A Linked List (25 分) Description: Given a singly linked list, you are supposed to rearrange its elements so that all the n 阅读全文
posted @ 2019-06-24 17:35 林東雨 阅读(219) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1066 Root of AVL Tree (25 分) Description: An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two chil 阅读全文
posted @ 2019-06-24 16:06 林東雨 阅读(218) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1114 Family Property (25 分) Description: This time, you are supposed to help us collect the data for family-owned property. Given each pe 阅读全文
posted @ 2019-06-23 16:48 林東雨 阅读(184) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1107 Social Clusters (30 分) Description: When register on a social network, you are always asked to specify your hobbies in order to find 阅读全文
posted @ 2019-06-23 15:11 林東雨 阅读(222) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-23 13:42:53 阅读全文
posted @ 2019-06-23 13:44 林東雨 阅读(374) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-21 14:42:04 做题时更多的是用到哈夫曼树的构造思想,即按照问题规模从小到大,依次解决问题,可以得到最优解 Description: 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。 每一次合并,多多可以 阅读全文
posted @ 2019-06-21 14:49 林東雨 阅读(890) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1003 Emergency (25 分) Description: As an emergency rescue team leader of a city, you are given a special map of your country. The map sho 阅读全文
posted @ 2019-06-19 16:06 林東雨 阅读(271) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1018 Public Bike Management (30 分) Description: There is a public bike service in Hangzhou City which provides great convenience to the t 阅读全文
posted @ 2019-06-19 15:36 林東雨 阅读(178) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1030 Travel Plan (30 分) Description: A traveler's map gives the distances between cities along the highways, together with the cost of ea 阅读全文
posted @ 2019-06-19 14:51 林東雨 阅读(226) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1072 Gas Station (30 分) Description: A gas station has to be built at such a location that the minimum distance between the station and a 阅读全文
posted @ 2019-06-18 17:08 林東雨 阅读(165) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1087 All Roads Lead to Rome (30 分) Description: Indeed there are many different tourist routes from our city to Rome. You are supposed to 阅读全文
posted @ 2019-06-18 15:52 林東雨 阅读(339) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-18 14:14:31 单源最短路径 即求图中某一顶点到其他各顶点的最短路径 Dijskra算法 权值非负 伪码描述 邻接矩阵实现 邻接表实现 多条最短路径求解第二尺度最优路径 算法实现 Dijskra算法+DFS 含有多个标准尺度的最短路径 Bellman-Ford算法 阅读全文
posted @ 2019-06-18 14:54 林東雨 阅读(889) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-17 17:47:15 算法思想 算法实现 相关练习 更新后的大纲把动态规划都删除了,但关键路径还留着,虽然一直没考过,说不准哪天就考了呢。 Source: Codeup 23132: 关键路径 题目描述 描述: 图的连接边上的数据表示其权值,带权值的图称作网。 上图可描述 阅读全文
posted @ 2019-06-17 17:56 林東雨 阅读(1601) 评论(0) 推荐(0) 编辑
摘要:Date:2019-06-17 14:43:59 算法描述 1.定义队列Q,并把所有入度为0的结点加入队列 2.取队首结点,输出。然后删除所有从它除法的边,并令这些边到达的顶点的入度-1,若某个顶点的入度为0,则加入队列Q 3.反复进行2操作,直至队列为空。 如果队列为空时入过队的结点数目恰好为N, 阅读全文
posted @ 2019-06-17 15:38 林東雨 阅读(744) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1111 Online Map (30 分) Description: Input our current position and a destination, an online map can recommend several paths. Now your job 阅读全文
posted @ 2019-06-16 18:32 林東雨 阅读(218) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1110 Complete Binary Tree (25 分) Description: Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification 阅读全文
posted @ 2019-06-16 17:39 林東雨 阅读(194) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1109 Group Photo (25 分) Description: Formation is very important when taking a group photo. Given the rules of forming K rows with Npeopl 阅读全文
posted @ 2019-06-16 16:59 林東雨 阅读(265) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A 1108 Finding Average (20 分) Description: The basic task is simple: given N real numbers, you are supposed to calculate their average. Bu 阅读全文
posted @ 2019-06-16 15:35 林東雨 阅读(264) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1115 Counting Nodes in a BST (30 分) Description: A Binary Search Tree (BST) is recursively defined as a binary tree which has the followi 阅读全文
posted @ 2019-06-11 21:14 林東雨 阅读(371) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1116 Come on! Let's C (20 分) Description: "Let's C" is a popular and fun programming contest hosted by the College of Computer Science an 阅读全文
posted @ 2019-06-11 20:49 林東雨 阅读(226) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1118 Birds in Forest (25 分) Description: Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appea 阅读全文
posted @ 2019-06-11 20:18 林東雨 阅读(197) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1119 Pre- and Post-order Traversals (30 分) Description: Suppose that all the keys in a binary tree are distinct positive integers. A uniq 阅读全文
posted @ 2019-06-10 21:48 林東雨 阅读(254) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1105 Spiral Matrix (25 分) Description: This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increa 阅读全文
posted @ 2019-06-08 18:26 林東雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1122 Hamiltonian Cycle (25 分) Description: The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. 阅读全文
posted @ 2019-06-03 22:31 林東雨 阅读(404) 评论(0) 推荐(0) 编辑
摘要:Date: 2019-04-11 18:49:18 AVL树的基本操作 判断一棵树是否为AVL树 阅读全文
posted @ 2019-06-03 21:30 林東雨 阅读(392) 评论(0) 推荐(0) 编辑
摘要:Date:2019-03-25 19:36:45 判断一棵树是否为完全二叉树 阅读全文
posted @ 2019-06-03 21:27 林東雨 阅读(455) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1123 Is It a Complete AVL Tree (30 分) Description: An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the 阅读全文
posted @ 2019-06-03 21:14 林東雨 阅读(221) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1125 Chain the Ropes (25 分) Description: Given some segments of rope, you are supposed to chain them into one rope. Each time you may onl 阅读全文
posted @ 2019-06-01 23:10 林東雨 阅读(206) 评论(0) 推荐(0) 编辑
摘要:Source: PAT A1126 Eulerian Path (25 分) Description: In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Simil 阅读全文
posted @ 2019-06-01 20:51 林東雨 阅读(138) 评论(0) 推荐(0) 编辑