Tag：Right son

Time：2021714
What is a binary search tree Binary search tree is also called binary search tree, ordered binary tree or sorted binary tree He has the following properties: If the left subtree of any node is not empty, the values of all nodes in the left subtree are less than the values of its root node; […]

Time：2021712
1. Three data structures in a set1.1 arrayContinuous memory addressIt can be accessed through subscript members, and subscript access has high performanceThere is a large performance consumption in add / delete operation (dynamic capacity expansion is required)1.2 linked list (bidirectional linked list)Flexible space requirements, storage space does not require continuitySubscript access is not supported, and […]

Time：2021628
Breadth traversal of binary tree Binary tree sequence traversal Binary tree depth traversal: preorder, mesorder, postorder Maximum depth of binary tree Binary search Given the path, traverse the tree to find the node with or without the specified path Quick sort The K largest Longest Common Prefix Longest substring without repeating characters There are many […]

Time：2021611
Portal: https://leetcodecn.com/probl…When learning binary trees, there is a property thatIf the preorder sequence and the middle sequence of traversing binary tree are given, then a unique binary tree can be constructedSo for this problem, the general idea can be solved according to this property. Because the condition of the problem is “balanced binary tree”, the […]

Time：2021610
Topic source here to verify binary search tree Detailed definition of binary search tree I’ll copy the title here~ Given a binary tree, judge whether it is an effective binary search tree. Suppose a binary search tree has the following characteristics: The left subtree of a node contains only the number less than the current […]

Time：2021530
Transformation between forest and binary tree and tree traversal The binary tree representation of forest Traversal of common trees The first root traversal of ordinary tree is the preorder traversal of binary tree after transformation The back root traversal of ordinary tree is the middle order traversal of corresponding binary tree Enumeration of binary trees […]

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：202132
Title Requirements Write a program to establish the binary list storage structure of the binary tree by using the preorder recursive traversal calendar (or input preorder and middle order recursive traversal node access sequence), calculate and output the total number of nodes and tree height of the binary tree, and then output its preorder, middle […]

Time：2021226
WeChat official account: Xiao Chao said This isSearch algorithmThe first article in the series helps you get started with binary trees What is a tree? Let’s start with some pictures: Among them, the first, second and fourth are all trees, and the third is not. The characteristics of trees are very obvious! Each element is […]

Time：2021222
1. Heap sort Heap sort is a sort algorithm designed with heap data structure. It is similar to a binary tree and has a characteristic that the value of parent node is greater than (less than) the value of child node. There are two kinds of heaps. The one whose parent node is larger than […]

Time：2021213
This isSearch algorithmThe second article in the series helps you master binary search tree thoroughly In the data structure, binary search tree is undoubtedly very important, but beginners have some difficulty in understanding, and the articles on the Internet are not very comprehensive.In this paper, we hope to combine multiple groups of moving pictures, pictures […]

Time：2021211
Binary tree Before that, let’s review the creation and basic methods of binary search treeMaster the following code, will be able to skillfully binary tree further operation var Node=function(key){ this.key=key; this.left=null; this.right=null; } class BinaryTree{ constructor(){ this.root=null; } //Insert node (as required by binary search tree) insert(key){ let newNode=new Node(key); if(this.root==null){ this.root=newNode; }else{ this.insertNode(this.root,newNode); } […]