随笔分类 -  PAT

摘要:Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va 阅读全文
posted @ 2018-01-17 18:26 gaoren 阅读(173) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2018-01-15 16:35 gaoren 阅读(146) 评论(0) 推荐(0)
摘要:Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M <= m * p where M and m are 阅读全文
posted @ 2017-12-16 18:36 gaoren 阅读(397) 评论(0) 推荐(0)
摘要:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the 阅读全文
posted @ 2017-12-15 16:09 gaoren 阅读(140) 评论(0) 推荐(0)
摘要:A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find t 阅读全文
posted @ 2017-12-07 21:18 gaoren 阅读(209) 评论(0) 推荐(0)
摘要: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 non-increasing order, and 阅读全文
posted @ 2017-12-02 10:37 gaoren 阅读(159) 评论(0) 推荐(0)
摘要:Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negative. For exam 阅读全文
posted @ 2017-12-01 14:02 gaoren 阅读(179) 评论(0) 推荐(0)
摘要:It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if 阅读全文
posted @ 2017-11-30 11:14 gaoren 阅读(201) 评论(0) 推荐(0)
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2017-11-29 19:56 gaoren 阅读(1231) 评论(0) 推荐(2)
摘要:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. 阅读全文
posted @ 2017-11-28 21:24 gaoren 阅读(198) 评论(0) 推荐(0)
摘要:The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist 阅读全文
posted @ 2017-11-27 21:24 gaoren 阅读(180) 评论(0) 推荐(0)
摘要:On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on sc 阅读全文
posted @ 2017-11-24 20:23 gaoren 阅读(231) 评论(0) 推荐(0)
摘要:Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum. Input Specification: Each input file contains o 阅读全文
posted @ 2017-11-23 20:34 gaoren 阅读(284) 评论(0) 推荐(0)
摘要:Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to Lis defined to be the sum of the 阅读全文
posted @ 2017-11-21 18:50 gaoren 阅读(251) 评论(0) 推荐(0)
摘要:People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzi 阅读全文
posted @ 2017-11-20 17:19 gaoren 阅读(255) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-11-19 19:07 gaoren 阅读(180) 评论(0) 推荐(0)
摘要:Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional 阅读全文
posted @ 2017-11-18 10:44 gaoren 阅读(209) 评论(0) 推荐(0)
摘要:Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push ( 阅读全文
posted @ 2017-11-17 16:15 gaoren 阅读(183) 评论(0) 推荐(0)
摘要:For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decre 阅读全文
posted @ 2017-11-16 21:40 gaoren 阅读(236) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-11-15 17:58 gaoren 阅读(240) 评论(0) 推荐(0)