随笔分类 -  PAT

摘要:A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po 阅读全文
posted @ 2021-02-25 16:02 XA科研 阅读(91) 评论(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 @ 2021-02-25 00:15 XA科研 阅读(75) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2021-02-24 23:33 XA科研 阅读(82) 评论(0) 推荐(0)
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to out 阅读全文
posted @ 2021-02-24 22:27 XA科研 阅读(79) 评论(0) 推荐(0)
摘要:Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operat 阅读全文
posted @ 2021-02-24 21:43 XA科研 阅读(72) 评论(0) 推荐(0)
摘要:假设二叉树中的所有键都是不同的正整数。可以通过给定的一对后序遍历和有序遍历序列来确定唯一的二叉树。这是一个简单的标准例程,可以按级别顺序打印数字。但是,如果您认为问题太简单了,那就太天真了。这次,您应该按“曲折顺序”打印数字-也就是说,从根开始,逐级打印数字,从左到右和从右到左交替。例如,对于以下树 阅读全文
posted @ 2021-02-24 20:58 XA科研 阅读(85) 评论(0) 推荐(0)
摘要: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, th 阅读全文
posted @ 2021-02-24 19:53 XA科研 阅读(82) 评论(0) 推荐(0)
摘要:The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a 阅读全文
posted @ 2021-02-24 17:37 XA科研 阅读(83) 评论(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 @ 2021-02-24 16:32 XA科研 阅读(72) 评论(0) 推荐(0)
摘要: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 ino 阅读全文
posted @ 2021-02-24 15:31 XA科研 阅读(85) 评论(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 @ 2021-02-24 11:30 XA科研 阅读(87) 评论(0) 推荐(0)
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2021-02-23 23:58 XA科研 阅读(75) 评论(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 @ 2021-02-23 23:26 XA科研 阅读(76) 评论(0) 推荐(0)
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2021-02-23 22:41 XA科研 阅读(56) 评论(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 @ 2021-02-23 00:32 XA科研 阅读(70) 评论(0) 推荐(0)
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2021-02-22 23:27 XA科研 阅读(71) 评论(0) 推荐(0)
摘要:Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​. The weight of a path from R to L is defined to be the sum 阅读全文
posted @ 2021-02-22 21:46 XA科研 阅读(73) 评论(0) 推荐(0)
摘要:Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social n 阅读全文
posted @ 2021-02-22 21:44 XA科研 阅读(74) 评论(0) 推荐(0)
摘要:A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po 阅读全文
posted @ 2021-02-22 00:04 XA科研 阅读(64) 评论(0) 推荐(0)
摘要:A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique 阅读全文
posted @ 2021-02-21 22:26 XA科研 阅读(126) 评论(0) 推荐(0)