Binary tree
Definition of binary tree
A binary tree is a finite set of nodes (recursively defined) ① This set is either empty; ② Or it is composed of a root node and two disjoint binary trees called left subtree and right subtree.
Five basic forms of binary tree
Difference between binary tree and quadratic tree
① Different degrees
A tre ...

Data structure - linked list
Three, five, seven words
Don't let data structures become the ceiling
Relevant code address
concept
Linked list is not only a linear structure, but also a natural recursive structure. Linked list structure can make full use of computer memory space and realize flexible dynamic memory management. However, the link ...

Posted by Tentious on Fri, 06 May 2022 20:26:15 +0300

Binary tree implementation
//Node class of tree
public class TreeNode<T> {
//Store data
public T data;
//Point to left child and right child nodes
public TreeNode<T> left,right;
public TreeNode(T data, TreeNode<T> left, TreeNode<T> right) {
super();
this.data = data;
this.le ...

Posted by Ambush Commander on Fri, 06 May 2022 08:18:21 +0300

During this period of time, I wrote a lot of source code analysis. This article wants to change the taste and share with you a case I encountered in my work. After all, as a part-time worker, in addition to looking at the source code at work, bricks still have to be moved. This article will share a story of using appropriate data structures to ...

Posted by ready2drum on Fri, 06 May 2022 07:42:09 +0300

How to learn redis?
Learn what redis isHow to use redis, how to operate the data structure in redisTypical applications and operationsRead the redis source code
1. Redis
Redis is the abbreviation of Remote Dictionary Service; it is also a remote dictionary service; Redis is an in-memory database, KV database, data structure database; Red ...

Posted by cryp7 on Thu, 05 May 2022 16:53:18 +0300

The "six degree space" theory is also known as the "Six Degrees of Separation" theory. This theory can be popularly stated as: "there will be no more than six people between you and any stranger, that is, you can know any stranger through up to five people." As shown in Figure 1:
Although the "six dimensi ...

Posted by DragonHighLord on Wed, 04 May 2022 13:11:02 +0300

This column is mainly used to help Java users quickly get started with data structures and brush algorithm problems!
preface
Since ancient times, the data structure industry has been divided into nine days. It is said that after breaking through these nine days, you can attack the algorithm industry and finally become a man, which is respec ...

Posted by dsaba on Tue, 03 May 2022 23:14:47 +0300

Follow the previous article How is heap used in the program? Is there a memory leak? , since using the default heap may cause problems, what if you don't use the default heap at all? So I had the following idea: 1. Use a large area of the global area as the custom heap memory (g_heap[MAX_HEAP_SIZE] in the code). All heap allocation requests and ...

Posted by simonmlewis on Tue, 03 May 2022 21:53:50 +0300

1. Sequential storage
The root node bit order is 0. The remaining nodes, assuming the bit order is i, if the left child exists, the left child is 2i+1.
If the right child exists, the right child is 2i+2. Its parent nodes are all (i-1)/2.
If the node does not exist, it can be marked with a number.
The disadvantage is that it is eas ...

Posted by tha_mink on Tue, 03 May 2022 20:11:07 +0300