Tag:Binary tree
-
Time:2021-4-15
[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:2021-4-13
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:2021-4-7
-
Time:2021-4-2
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:2021-3-30
A binary tree with n nodes is stored in the one-dimensional 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 i-th node in the binary tree (I is numbered with the above method from 1) in the array […]
-
Time:2021-3-26
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 (2020-02-08) 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:2021-3-22
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:2021-3-16
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:2021-3-15
297. Serialization and deserialization of binary tree Title Source: leetcode https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree 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:2021-3-8
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:2021-3-5
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:2021-3-4
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 […]