摘要:1106 Lowest Price in Supply Chain (25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in m
阅读全文
摘要:1124 Raffle for Weibo Followers (20 分) John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo --
阅读全文
摘要:1142 Maximal Clique (25 分) A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A
阅读全文
摘要:1146 Topological Order (25 分) This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtaine
阅读全文
摘要:1138 Postorder Traversal (25 分) Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal se
阅读全文
摘要:1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters
阅读全文
摘要:1140 Look-and-say Sequence (20 分) Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D
阅读全文
摘要:1125 Chain the Ropes (25 分) Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into l
阅读全文
摘要:1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to thos
阅读全文
摘要:1086 Tree Traversals Again (25 分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that w
阅读全文
摘要:pat甲级,树的邻接表存储,dfs,优先级队列
阅读全文
摘要:pat甲级,二叉搜索树的建立,dfs求每层结点树
阅读全文
摘要:pat甲级,出栈顺序是否合理,通过简单模拟方法进行判断。
阅读全文
摘要:1064 Complete Binary Search Tree (30 分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The lef
阅读全文
摘要:1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in n
阅读全文
摘要:1054 The Dominant Color (20 分) Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each
阅读全文
摘要:1102 Invert a Binary Tree (25 分) The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but yo
阅读全文
摘要:1094 The Largest Generation (25 分) A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same
阅读全文