leetcode DFS+BFS+DSU question brushing summary 2
leetcode DFS+BFS+DSU question brushing summary 2
1-symmetric binary tree Title Link: Link here!!!
Idea 1: iterative method For a binary tree, the left and right subtrees enter the queue respectively. If the left and right subtrees are empty, the traversal ends. If only one of the left and right subtrees is empty, or the root nodes of the left ...
Added by xlordt on Sun, 27 Feb 2022 15:58:15 +0200
[data organization and algorithm] in-depth analysis of the solution idea and algorithm example of "verifying binary search tree"
1, Title Requirements
Give you the root node of a binary tree, root, and judge whether it is an effective binary search tree.A valid binary search tree is defined as follows:
The left subtree of a node contains only the number less than the current node.
The right subtree of a node only contains a number greater than the current node. ...
Added by PhantomCode on Wed, 16 Feb 2022 08:32:07 +0200
[data structure and algorithm] in-depth analysis of the solution ideas and algorithm examples of "different paths"
1, Title Requirements
A robot is located in the upper left corner of an m x n grid (the starting point is marked as "Start" in the figure below). The robot can only move down or right one step at a time. The robot tries to reach the lower right corner of the grid (marked as "Finish" in the figure below). How many different ...
Added by chris_s_22 on Wed, 09 Feb 2022 23:34:09 +0200
In the process of Spring Bean instance, how to use Bean properties of reflection and recursive processing to fill in?
Author: Xiao Fu Ge Blog: https://bugstack.cn
Precipitate, share and grow, so that you and others can gain something! 😄
Catalogue of Spring hand roll column
Chapter 1: Opening introduction, I'm going to take you to Spring! Chapter 2: Small test ox knife, to achieve a simple Bean container Chapter 3: First show your skill and use desig ...
Added by steve@MRS on Wed, 02 Feb 2022 04:08:37 +0200
Algorithm design and analysis
summary
Violent recursion is an attempt (local attempt)The problem is transformed into a sub problem of the same kind of problem with reduced scaleSpecify the condition for the end of recursion (base case)After getting the results of the subproblem, there is a decision-making processDo not record the solution of each sub problem, try the m ...
Added by meckr on Sat, 29 Jan 2022 18:37:32 +0200
[Leetcode]124. Maximum path sum in binary tree
Title Description
A path is defined as a sequence that starts from any node in the tree and connects along the parent node to the child node to reach any node. The same node can appear at most in a path sequence. Therefore, the path contains at least one node and does not necessarily pass through the root node.
Path sum is the sum of the ...
Added by bhoward3 on Thu, 27 Jan 2022 07:27:55 +0200
[Leetcode] 105. Constructing Binary Trees from Pre-order and Medium-order Traversal Sequences
Title Description
Given a tree, preorder and inorder are traversed sequentially. Please construct a binary tree and return its root node.
Example 1
Input: preorder = [3,9,20,15,7], inorder=[9,3,15,20,7]
output:[3,9,20,null,null,15,7]
Example 2
Input: preorder=[-1], inorder=[-1]
output: [-1]
Tips
...
Added by tHud on Wed, 26 Jan 2022 22:50:59 +0200
Binary tree recursion routine: judge whether the binary tree is the maximum distance of searching binary tree and binary tree
This article continues to talk about the recursive routine of binary trees.1, Determine whether the binary tree is a search binary treeSearch binary tree definition: for any subtree with X as the head in a binary tree, the left subtree is smaller than X and the right subtree is larger than x. (the classic search binary tree has no duplicate val ...
Added by anthony88guy on Fri, 21 Jan 2022 04:47:53 +0200
Algorithm exercise: adding two numbers
Add two numbers
Give you two non empty linked lists to represent two non negative integers. They store each number in reverse order, and each node can store only one number.
Please add the two numbers and return a linked list representing sum in the same form.
You can assume that neither number starts with 0 except the number 0.
Example 1:
Inp ...
Added by OttoBufonto on Mon, 17 Jan 2022 14:05:27 +0200
Leetcode.863. Enhancement of all K-distant nodes in a binary tree --- Further understanding of tree width, recursive reverse node finding, and function
0. Preface
The brushing algorithm clocked in for the sixth day and today picked up a moderate problem. But with the precipitation knowledge of the previous problem solving, it doesn't feel too painful to solve today. But there is something new to settle, so this is a record. That's how the brushing algorithm works. It's okay in general ...
Added by krishnam1981 on Mon, 10 Jan 2022 20:04:22 +0200