Article directory Binary tree OJ question 1. Check whether the two numbers are the same 1. Ideas 2. Problem solving steps 3.Code 2. A subtree of another tree 1. Ideas 2.Code 3. Flip the binary tree 1. Ideas 2. Problem solving steps 3.Code 4. Judgment of Balanced Binary Tree 1. Ideas 2.Code 5. Symmetric binary […]
Tag: subtree
[Data structure binary tree] Pre-order level establishment, recursive non-recursive traversal, level-order traversal, tree height, mirror, symmetry, subtree, merge, target path, weighted path sum, etc.
Binary tree Article directory Binary tree 1. Creation of binary tree (recursive creation, structure pointer form) 1.1. Preorder establishment 1.2. Establishment of layer sequence 2. Recursive traversal (structure pointer) 2.1. Preorder traversal 2.2. In-order traversal 2.3. Postorder traversal 3. Non-recursive traversal (structure pointer) 3.1. Level traversal 3.2. Postorder traversal (non-recursive) 4. Find the height of […]
Binary tree – returns the largest binary search subtree size
Title: Given the head node of a binary tree, return the size of the largest binary search subtree in the binary tree. For a binary tree, the whole tree may not be a search binary tree, but the subtree is a search binary tree. As shown in the figure below, the maximum number of nodes […]
Git – – subtree and submodule
https://www.cnblogs.com/anliven/p/13681894.html Directory 1 – Repository sharing (subrepositories, subprojects) 2 – submodule vs. subtree 2.1 git submodule 2.2 git subtree 3 – subtree 3.1 Add a new sub-warehouse in the parent warehouse 3.2 Changes to the parent repository 3.3 Pulling updates from sub-warehouses 3.4 Push the modification of the sub-repository 3.5 Sub-warehouse cut-out starting point 4-submodule […]
F. Subtree Minimum Query
Subtree Minimum Query – Luogu F. Subtree Minimum Query time limit per test 6 seconds memory limit per test 512 megabytes input standard input output standard output You are given a rooted tree consisting of n vertices. Each vertex has a number written on it; number ai is written on vertex i. Let’s denote d(i,?j) […]
Binary Tree | 8 101. Symmetrical Binary Tree & 572. Subtree of Another Tree
This article records the important concepts and notes in the process of brushing the questions. If there is any infringement, please contact to delete. Table of Contents 101. Symmetric Binary Tree train of thought recursive method iterative method — queue Iteration method — stack Similar to: 572. Subtree of another tree train of thought 101. […]
Java “menu” tree recursion – merge subtrees
1. Problem description As shown in the screenshot below, the top level is the “core indicator”, that is, the trunk, followed by the subtree branch “Spatial Quality”, and “urban housing area per capita (m2)” is the last level of the subtree. The next merge we have to do is that there is a branch under […]
[Binary tree OJ question (2)] Pre-order traversal && in-order traversal && post-order traversal && subtree of another tree && binary tree traversal && balanced binary tree
? ?Personal homepage: @Sherry’s growth path Learning community: Sherry’s growth path (personal community) Column Link: Data Structure There is a long way to go, and everything is expected Article directory Binary tree OJ exercise (2) 1. Preorder traversal of binary tree 2. Inorder traversal of a binary tree 3. Post-order traversal of binary tree 4. […]
LeetCode 1617. Count Subtrees With Max Distance Between Cities [Mathematics, Binary Enumeration, Bit Operation, State Compression, Tree DP, BFS, DFS] Difficult
There are n cities numbered from 1 to n. You are given an array edges of size n -1, where edges[i] = [ui, vi] represents a bidirectional edge between cities ui and vi. There exists a unique path between each pair of cities. In other words, the cities form a tree. A subtree is a […]
LC-1617. Statistical subtree maximum distance between cities (backtracking + tree diameter)
Solution: 0x3f【https://leetcode.cn/problems/count-subtrees-with-max-distance-between-cities/solution/tu-jie-on3-mei-ju-zhi-jing-duan-dian-che- am2n/ 1617. The maximum distance between cities in the statistical subtree Difficulty Hard 113 You are given n cities, numbered from 1 to n . At the same time, give you an array edges of size n-1, where edges[i] = [ui, vi] represents the city There is a bidirectional edge between ui and […]