Tag:Right son

  • Binary tree (3): binary search tree

    Time:2021-7-14

    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

    Time:2021-7-12

    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

    Time:2021-6-28

    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

    Time:2021-6-11

    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

    Time:2021-6-10

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

  • Trees and binary trees (3)

    Time:2021-5-30

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

  • Leetcode 101. Symmetric binary tree | Python

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

  • [data structure] – traversal algorithm of binary tree

    Time:2021-3-2

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

  • Search algorithm series (1) basis of binary tree

    Time:2021-2-26

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

  • Sorting algorithm 05 ——– heap sorting (Graphic)

    Time:2021-2-22

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

  • A thorough grasp of binary search tree (multi group moving graph)

    Time:2021-2-13

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

  • JS implementation of binary tree related algorithm – leetcode collation (continuous update)

    Time:2021-2-11

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