# Trees and binary trees (2)

Time：2021-5-31

### Storage structure of binary tree

##### Sequential storage

• Because binary tree is more flexible, sequential representation will waste a lot of space, so it is generally not used, unless it is full binary tree or full binary tree
##### Chain representation

• It is stored in a linear structure, so the allocation of storage space is not very flexible. If a tree of known length is implemented, it is impossible to insert or delete data

### Storage structure of tree

#### Sequential representation

##### Parents express

Advantages: simple structure, a sequence table can store a tree
Disadvantages: static structure, not convenient to do node insertion and deletion; There is a waste of storage space; Because most of the application of tree is to find children from the node, and the parent representation is often used to find parents from the node, but the application in finding children from the node is more troublesome, so it needs to scan the whole tree.

#### Chain structure

##### Multilist (child representation)
• Similar to binary list, it wastes more space
##### Children‘s list

Considering the data and relationship, we first construct an array to store each node (data part); The relationship between the children and their parents is represented by the continuous structure. That is to say, all nodes are stored in array first, and then each node generates a single chain table to store all children of the node

##### Representation of left child, female and right brother of tree (binary linked list representation)

If the ordinary tree is transformed into a very familiar binary tree form, one-to-one correspondence can be formed, and the binary tree can be used to store the ordinary tree without losing the information of the ordinary tree

## Dandelion · Jerry technology weekly Vol.21 – technology weekly · React Hooks vs Vue 3 + Composition API

Dandelion · Jerry technology weekly Vol.21 Choose react or Vue, everyone will have their own answer in their heart. There are many reasons to pick the framework of heart water, but when we ask ourselves, can we really evaluate the difference between the two. Perhaps we should return to the original intention and look at […]