PAT甲级题分类之树
汇总了PAT甲级里面考查树的题目
NTaurus
这个作者很懒,什么都没留下…
展开
-
Build A Binary Search Tree
1099 Build A Binary Search TreeA 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 with keys less than the node’s key.The right subtree of a node contains原创 2020-06-14 10:13:53 · 183 阅读 · 0 评论 -
1094 The Largest Generation (25分)
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 generation. Your task is to find the generation with the largest population.Input Specification:Each in原创 2020-06-14 10:11:51 · 115 阅读 · 0 评论 -
1086 Tree Traversals Again (25分)
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 when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack operations are: push原创 2020-06-14 10:10:35 · 86 阅读 · 0 评论 -
1066 Root of AVL Tree (25分)
1066 Root of AVL Tree (25分)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 time they differ by more than one, rebalancing is done to restore this prope原创 2020-06-14 10:09:29 · 115 阅读 · 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 left subtree of a node contains only nodes with keys less than the node’s key.The right subtree of a node con原创 2020-06-14 10:08:12 · 117 阅读 · 0 评论 -
Path of Equal Weight (30分)
1053 Path of Equal Weight (30分)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 L is defined to be the sum of the weights of all the nodes along the path from R to any leaf no原创 2020-06-14 10:07:15 · 202 阅读 · 0 评论 -
1043 Is It a Binary Search Tree (25分)
1043 Is It a Binary Search Tree (25分)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 with keys less than the node’s key.The right subtree of a node cont原创 2020-06-14 10:04:35 · 84 阅读 · 0 评论 -
1020 Tree Traversals (25分)
1020 Tree Traversals (25分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree.Input原创 2020-06-14 10:02:33 · 91 阅读 · 0 评论 -
1004 Counting Leaves (30分)
1004 Counting Leaves (30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line containing 0<N&原创 2020-06-14 09:56:28 · 143 阅读 · 0 评论