
PAT甲级
分题型刷题
志明er
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT A1102. Invert a Binary Tree (25) [树的遍历]
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 whiteboard so fuck off. Now it’s your turn to pro...原创 2020-01-16 09:36:33 · 157 阅读 · 0 评论 -
PAT A1099. Build A Binary Search Tree (30) [⼆叉查找树BST]
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 subt...原创 2020-01-16 09:07:16 · 188 阅读 · 0 评论 -
PAT A1094. The Largest Generation (25) [BFS, DFS,树的遍历]
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 S...原创 2020-01-16 08:24:41 · 168 阅读 · 0 评论 -
PAT A1090. Highest Price in Supply Chain (25) [树的遍历]
A supply chain is a network of retailers(零售商) , distributors(经销商) , and suppliers(供应商) – everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on t...原创 2020-01-16 07:47:13 · 214 阅读 · 0 评论 -
PAT A1086. 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 stac...原创 2020-01-15 20:17:52 · 148 阅读 · 0 评论 -
【笔记】已知先序、中序,构建二叉树
给定二叉树的先序遍历序列 和中序遍历序列,构建二叉树: 原理: 代码: node* create(int preL,int preR,int inL,int inR){ if(preL > preR){ return NULL; } node* root = new node; root->data = pre[preL]; int k; for(k = in...原创 2020-01-14 20:47:39 · 268 阅读 · 0 评论 -
PAT A1079. Total Sales of Supply Chain (25) [DFS, BFS,树的遍历]
A supply chain is a network of retailers(零售商) , distributors(经销商) , and suppliers(供应商) – everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on t...原创 2020-01-05 17:56:26 · 128 阅读 · 0 评论 -
PAT A1066. Root of AVL Tree (25) [平衡⼆叉树(AVL树) ]
An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node difer by at most one; if at any time they difer by more than one, rebalancing is d...原创 2020-01-05 17:21:18 · 129 阅读 · 0 评论 -
PAT A1064. Complete Binary Search Tree (30) [⼆叉查找树BST]
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The lef subtree of a node contains only nodes with keys less than the node’s key. The right subtr...原创 2020-01-05 17:04:15 · 145 阅读 · 1 评论 -
PAT A1057. Stack (30) [树状数组]
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 (inserting an element onto the top position) and Po...原创 2020-01-03 20:26:18 · 120 阅读 · 0 评论 -
PAT A1053. 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...原创 2020-01-03 17:44:14 · 111 阅读 · 0 评论 -
PAT A1043. Is It a Binary Search Tree (25) [⼆叉查找树BST]
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The lef subtree of a node contains only nodes with keys less than the node’s key. The right subtr...原创 2019-12-31 17:03:33 · 166 阅读 · 0 评论 -
PAT A1020. 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 cor...原创 2019-12-30 20:23:19 · 186 阅读 · 0 评论 -
PAT A1004 (30) [BFS, DFS,树的层序遍历]
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with a line cont...原创 2019-12-30 19:02:08 · 163 阅读 · 0 评论