Binary tree recursive routine: judge whether it is a full binary tree and the number of nodes of the largest sub search binary tree

Today, continue the recursive routine of binary tree.1, Determine whether it is a full binary treeFull binary tree definition: for a binary tree with height h, the number of nodes is (2^h - 1)1. Recursive routine ideaAccording to the definition of full binary tree, we only need to obtain the height and the number of nodes each time.That is, we ...

Posted by elementaluk on Tue, 25 Jan 2022 04:46:06 +0100

Looking at the source code step by step: HashMap container source code series 3 (its 1, data structure, put method, tree method)

Hashmap Underlying data structure: jdk1 7 hash table (array + linked list), jdk1 8 array + linked list / red black tree. Here I'll introduce it in detail. Of course, if you want to understand the evolution of the tree, you can see my next article. Let's start with the data structure: Underlying data structure Hash table Let's take a look at ...

Posted by iamtheironman on Sun, 23 Jan 2022 21:50:21 +0100

2021-06-26 force deduction algorithm problem summary

@Binary tree summary Binary tree phased summary From today on, I began to record my daily study and life. I didn't blog much before. Although I learned some Markdown grammar, I'm still not very familiar with it. The topics of Li Kou are recorded through pycharm. Later, in this form, I'll record all kinds of learning, do algorithm problems and ...

Posted by MrBillybob on Sun, 23 Jan 2022 13:49:58 +0100

LeedCode 617: merge binary trees

Path sum Title 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 after node merging. Otherwise, the node that is not ...

Posted by fsumba on Sat, 22 Jan 2022 11:41:53 +0100

The nearest common ancestor of the binary tree of sword finger offer

Words written before: Sword finger offer brushes the questions for the second time. I hope each question can last for seconds. Record your understanding of the topic from the back to the front. Nearest common ancestor of binary tree Problem description problem analysis Nearest common ancestor: according to the definition of encyclopedia, ...

Posted by evaoparah on Sat, 22 Jan 2022 10:24:03 +0100

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

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

[LeetCode] determine a binary tree

preface This paper shows the topics related to determining a binary tree in LeetCode, which readers can use to write by dictation to check whether they are familiar with the relevant algorithms. The difficulty is medium. LeetCode topic Related topic types Related links 105 Constructing binary tree from preorder and inorder traversal sequ ...

Posted by mazman on Sun, 16 Jan 2022 05:50:18 +0100

Review of data structure -- three traversal methods of binary tree

Review of data structure -- traversal of binary tree stl of c + + is used here. Remember to add header files The language description may be confusing and the time is limited. It is mainly used for self review. The code problem should not be big Establishment of binary tree structure typedef struct BiTNode { char data; struct BiTNode* ...

Posted by szcieder on Sun, 16 Jan 2022 04:40:19 +0100