Tag：Binary tree

Time：2021415
[22]. Bracket generation /* * @lc app=leetcode.cn id=22 lang=javascript * *[22] bracket generation */ // @lc code=start /** * @param {number} n * @return {string[]} */ //Solution: backtracking + pruning var generateParenthesis = function (n) { var res = []; var initialPath = ”; dfs(res, n, n, initialPath); return res; function dfs(res, left, right, path) […]

Time：2021413
101. Symmetric binary tree subject Given a binary tree, check whether it is mirror symmetric. For example, a binary tree [1,2,2,3,4,4,3] is symmetric. 1 / \ 2 2 / \ / \ 3 4 4 3 But the following [1,2,2, null, 3, null, 3] is not mirror symmetric: 1 / \ 2 2 \ \ […]

Time：202147

Time：202142
Huffman tree In a tree, all nodes from one node to another are called paths between two nodes. In the above binary tree, the path from root node a to leaf node h is a, B, D and H. In a tree, the number of “edges” passing from one node to another is called the […]

Time：2021330
A binary tree with n nodes is stored in the onedimensional array a [1.. n] from top to bottom and from left to right in the same layer, then the position of the right child of the ith node in the binary tree (I is numbered with the above method from 1) in the array […]

Time：2021326
The construction of binary tree is a common test point of binary tree, compared with the direct inspection of binary tree traversal, this problem will be more difficult. So far (20200208) leetcode has three topics about the construction of binary tree, which are: 105. Construct binary tree from preorder and mesorder traversal sequences 106. Construct […]

Time：2021322
Tree is an important kind of nonlinear data structure. This paper introduces the basic concepts, terms and properties of trees. 1、 Basic concepts and terms of trees Trees can be seen everywhere in life Trees have many characteristics: there is a root, the root can be divided into trunk, trunk can be divided into many […]

Time：2021316
stayA summary of the basic concepts and terms of treesThis paper introduces the basic structure of binary tree. stayDon’t know how to use recursion? Step by step!This article describes how to use recursion. The structure of binary tree is recursive, so creating and traversing can also be realized by recursion. Here is a binary tree: […]

Time：2021315
297. Serialization and deserialization of binary tree Title Source: leetcode https://leetcodecn.com/problems/serializeanddeserializebinarytree subject Serialization is the operation of converting a data structure or object into continuous bits, and then the converted data can be stored in a file or memory. At the same time, it can also be transferred to another computer environment through the network, […]

Time：202138
preface This article is included in the album:http://dwz.win/HjK, click to unlock more knowledge of data structure and algorithm. Hello, I’m brother Tong, a hard core man who climbs 26 floors every day and doesn’t forget to read the source code. In the previous section, we used bitmap to introduce the implementation of 12306 ticket grabbing […]

Time：202135
ARTS Arts is an activity launched by Chen Hao in the geek time column. The purpose is to keep learning through sharing. Each person writes an arts every week: algorithm is an algorithm problem, review is to read an English article, technology / tips is to share a small technology, share is to share a […]

Time：202134
Perception: Taste: ants on the tree Cooking time: 10min This article has been included inGithub github.com/GeekhytThank you, star. Mr. Zhou Shuren once said: if you learn tree well, you will master half of data structure and algorithm! Canteen owner (Tong oba): even if we are the leaf nodes in the Internet wave, we also need […]