Tag:Right son

  • Literacy data structure – Introduction to binary tree


    What is a binary tree There is a root nodeExpand two child nodes downThe two child nodes can expand downward. A structure similar to this becomes a binary tree <img style=”zoom:50%;” /> The above is enough to be a binary tree. Of course, if there is a binary tree, there are Trident trees and Quad […]

  • Red and black trees are actually very simple


    1. Background In the development process, it is necessary to maintain a set of data and quickly add, delete, modify and query. If the amount of data is large and needs to be persisted, choose the database. However, if the amount of data is relatively small, does not need persistence, and requires high response time, […]

  • Interview question 33. Post order traversal sequence of binary search tree


    Interview question 33. Post order traversal sequence of binary search tree Method 1: divide the left and right subtrees and recursion In the sequence traversed by post order, the root must be the last.Except for the root, the sequence of the left subtree is in the front and the right subtree is in the back. […]

  • I understand the concept and principle of binary tree


    Recommended reading for this series of articles [sequence table of data structure] use diagrams and codes to make you understand the linear table of sequence structure How to master a sharp weapon of C language – pointer? [linked list of data structure] after reading this article, I finally understand the linked list [stack of data […]

  • After the binary tree is created, how to use recursion and stack to traverse the binary tree?


    0. Preface Above[concept and principle of binary tree]This paper mainly introduces the related concepts and principles of tree. The main content of this paper is the creation of binary tree and the code implementation of traversal, including recursive traversal and stack traversal. 1. Implementation idea of binary tree 1.0. Sequential storage – array implementation The […]

  • Data structure – beginner binary tree creation


    Binary tree is an important type of tree structure. The data structure abstracted from many practical problems is often in the form of binary tree. Even a general tree can be simply transformed into binary tree, and the storage structure and algorithm of binary tree are relatively simple, so binary tree is particularly important. The […]

  • Data structure – traversal of ordinal recursion in binary tree


    Data structure – after learning the binary tree creation article, we will sort the binary tree in middle order and output an ordered data.The middle order traversal of binary tree is to traverse the left subtree first, then access the current node, and finally traverse the right subtree. For the following binary tree, the middle […]

  • Binary tree (3): binary search tree


    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; […]

  • Basic data structure in Java set


    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 […]

  • Algorithm of handwritten topic


    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 […]

  • Leetcode 449


    Portal: https://leetcode-cn.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 […]

  • Verify binary search tree


    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 […]