随笔分类 -  PAT甲级

上一页 1 2 3 4 5 下一页

1106 Lowest Price in Supply Chain (25 分)dfs
摘要:1106 Lowest Price in Supply Chain (25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in m 阅读全文

posted @ 2019-01-26 18:35 ZhangのBlog 阅读(311) 评论(0) 推荐(0)

1124 Raffle for Weibo Followers (20 分)
摘要: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 -- 阅读全文

posted @ 2019-01-26 15:47 ZhangのBlog 阅读(137) 评论(0) 推荐(0)

1142 Maximal Clique (25 分)图
摘要: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 阅读全文

posted @ 2019-01-26 14:42 ZhangのBlog 阅读(163) 评论(0) 推荐(0)

1146 Topological Order (25 分)判断拓扑序列
摘要: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 阅读全文

posted @ 2019-01-26 13:00 ZhangのBlog 阅读(306) 评论(0) 推荐(0)

1138 Postorder Traversal (25 分)前序和中序遍历转为后序
摘要:1138 Postorder Traversal (25 分) Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal se 阅读全文

posted @ 2019-01-25 20:50 ZhangのBlog 阅读(583) 评论(0) 推荐(0)

1119 Pre- and Post-order Traversals (30 分)前序、后序序列转为中序
摘要:pat甲级,二叉树遍历 阅读全文

posted @ 2019-01-24 21:32 ZhangのBlog 阅读(263) 评论(0) 推荐(0)

1050 String Subtraction (20 分)哈希 map
摘要:1050 String Subtraction (20 分) Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters 阅读全文

posted @ 2019-01-24 17:53 ZhangのBlog 阅读(205) 评论(0) 推荐(0)

1140 Look-and-say Sequence (20 分)简单模拟
摘要: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 阅读全文

posted @ 2019-01-24 16:23 ZhangのBlog 阅读(203) 评论(0) 推荐(0)

1125 Chain the Ropes (25 分)排序
摘要: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 阅读全文

posted @ 2019-01-24 15:49 ZhangのBlog 阅读(198) 评论(0) 推荐(0)

1041 Be Unique 散列
摘要:pat甲级,散列 阅读全文

posted @ 2019-01-24 15:17 ZhangのBlog 阅读(105) 评论(0) 推荐(0)

1084 Broken Keyboard (20 分)字符串
摘要: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 阅读全文

posted @ 2019-01-24 15:00 ZhangのBlog 阅读(139) 评论(0) 推荐(0)

1086 Tree Traversals Again
摘要: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 阅读全文

posted @ 2019-01-24 13:50 ZhangのBlog 阅读(155) 评论(0) 推荐(0)

1053 Path of Equal Weight (30 分)树的遍历,vector数组排序,优先级队列
摘要:pat甲级,树的邻接表存储,dfs,优先级队列 阅读全文

posted @ 2019-01-23 16:24 ZhangのBlog 阅读(216) 评论(0) 推荐(0)

1115 Counting Nodes in a BST (30 分)建立二叉搜索树,求每层结点数目
摘要:pat甲级,二叉搜索树的建立,dfs求每层结点树 阅读全文

posted @ 2019-01-23 14:32 ZhangのBlog 阅读(172) 评论(0) 推荐(0)

1051 Pop Sequence (25 分)简单模拟
摘要:pat甲级,出栈顺序是否合理,通过简单模拟方法进行判断。 阅读全文

posted @ 2019-01-23 13:55 ZhangのBlog 阅读(117) 评论(0) 推荐(0)

1064 Complete Binary Search Tree (30 分)完全二叉树
摘要: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 阅读全文

posted @ 2019-01-23 13:03 ZhangのBlog 阅读(188) 评论(0) 推荐(0)

1083 List Grades (25 分)排序
摘要: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 阅读全文

posted @ 2019-01-23 12:30 ZhangのBlog 阅读(333) 评论(0) 推荐(0)

1054 The Dominant Color (20 分)map的使用
摘要: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 阅读全文

posted @ 2019-01-22 22:16 ZhangのBlog 阅读(137) 评论(0) 推荐(0)

1102 Invert a Binary Tree (25 分)dfs+层序+中序+后序遍历
摘要: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 阅读全文

posted @ 2019-01-22 21:56 ZhangのBlog 阅读(153) 评论(0) 推荐(0)

1094 The Largest Generation (25 分)dfs或bfs求图的最大宽度
摘要: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 阅读全文

posted @ 2019-01-22 18:03 ZhangのBlog 阅读(304) 评论(0) 推荐(0)

上一页 1 2 3 4 5 下一页