Binary tree recursion routine: judge whether the binary tree is a complete binary tree and whether the binary tree is a balanced binary tree

We are already familiar with the basic routine of binary tree. Next, let's talk about the recursive routine of binary tree, which can solve most binary tree problems in the interview, especially the tree dp problem. Its essence is to use the convenience of recursion to traverse binary tree.Judge whether the binary tree is a complete binary tree ...

Posted by hip_hop_x on Mon, 17 Jan 2022 18:02:57 +0100

C brush question: LeetCode 752 Open the turntable lock (medium) | BFS wide search detailed explanation

Next blog: C brush question: LeetCode 752 Open the turntable lock (medium) | BFS wide search detailed explanation (1) Hash version Add HASH data structure, be familiar with the use of uthash, and add constraints. Main constraints: Do not turn back, for example, if you turn forward once, you are not allowed to turn backCan't cross dean ...

Posted by Christian B. on Mon, 17 Jan 2022 15:17:37 +0100

Learning notes of Chapter 3 of Dahua data structure -- linear table

Definition of linear table Linear table: a finite sequence of zero or more data elements. The number n of linear table elements is defined as the length of the linear table. When n is 0, it is an empty table. In a complex linear table, a data element can be composed of several data items. Storage structure of linear table Sequential storag ...

Posted by Shroder01 on Mon, 17 Jan 2022 12:07:00 +0100

Sort -- 02 -- select sort

Select sort Sorting principle: During each traversal, it is assumed that the element at the first index is the minimum value, which is compared with the values at other indexes in turn. If the value at the current index is greater than the value at some other index, it is assumed that the value derived from some other index is the minimum val ...

Posted by tastyniall on Mon, 17 Jan 2022 12:06:00 +0100

Quick sort and merge sort)

The sorting time complexity of bubbling, insertion and sorting is O(n2), which has high time complexity and is suitable for small-scale data processing. For large-scale data sorting, merge sorting and quick sorting are more suitable. Both merge sort and quick sort use the idea of divide and rule. Merge sort The idea of merging and sorting ...

Posted by Digimatt on Mon, 17 Jan 2022 00:47:15 +0100

Traversal of java tree

In programming life, we always meet tree structure. These days, we just need to operate the tree structure, so we can record our own operation mode and process. Now suppose there is such a tree, (it doesn't matter whether it is a binary tree or not, and the principle is the same) 1. Breadth first traversal The English abbreviation is BFS, th ...

Posted by rinjani on Mon, 17 Jan 2022 00:03:03 +0100

Summer training match 1

A. metal collection Searched. It's found that it's a tree dp. This thing really doesn't, and it hasn't been done... So I can't understand it for the time being.. B solution of univariate cubic equation Solution idea: use floating-point numbers to enumerate from negative numbers to positive numbers. According to the position of t ...

Posted by wsh on Sun, 16 Jan 2022 23:00:40 +0100

Easy questions related to LeetCode binary tree --- binary tree

Question 1: merging binary trees LeetCode 617 : Merge binary tree Description: Given two binary trees, imagine that when you overlay one of them on the other, some nodes of the two binary trees will overlap. You need to merge them into a new binary tree. The merging rule is that if two nodes overlap, their values are added as the new value ...

Posted by iamtheironman on Sun, 16 Jan 2022 19:47:10 +0100

Training program - Platinum manual (personal information management system)

Training project - personal information management system preface This blog records the training project summary of rookie (I @~@) at the end of freshman year. It has been approved by the project team members before publication. Please keep the statement for reprint. Thank you. The main purpose of the project is to strengthen the abili ...

Posted by Nommy on Sun, 16 Jan 2022 18:19:30 +0100

Data structure - tree and binary tree-1

Experimental preparation: 1. Skillfully use pointer for program design and master structure pointer. 2. Master the use of structure pointer to access structure variables. 3. Master the use of pointers as function parameters. 4. Understand the meaning, purpose and processing method of tree and binary tree. 1, Experimental purpose Understand a ...

Posted by searchman on Sun, 16 Jan 2022 15:06:51 +0100