Introduction to binary tree, B-tree/B-tree

anzhi zhu
8 min readJul 16, 2024

Preface

Because I am a dull person, I always like to express abstract things in concrete terms. For all kinds of dazzling trees, you only need to recognize that they are just a kind of data structure, similar to the familiar words such as array, slice, list, map, etc. For a data structure, it is nothing more than adding, deleting, modifying and checking. Since all kinds of trees are also data structures, they cannot escape the shackles of adding, deleting, modifying and checking.

So, why do we need a tree data structure? Can’t we just use an array or a slice? Of course, the real world is colorful and messy, and there is no panacea-like data structure to cope with the ever-changing business needs. Therefore, there are various types of trees, and some “advanced” data structures are based on tree data structures, such as mapping.

Binary Tree

It is difficult to distinguish between nodes, so in the following text, node represents “node”, root node represents root node, and child node represents “child node”.

The binary tree is the ancestor of many tree structures. As for why it is not a ternary tree or a quadtree, it may be because computers can only count to two. Haha, just kidding. The binary tree is very simple. Each node has at most two child nodes. The first node is called the root node.

--

--