Multi-path search tree of data structure and algorithm (28)

Daily demo of learning data structures and algorithms

Problem analysis of binary tree

Insert picture description here

2-3 of the multi-fork tree

Insert picture description here

2-3 tree construction diagram

Insert picture description here
Insert picture description here
Insert picture description here

B tree, B + tree, B * tree of multi-fork tree

Introduction to B-tree

Insert picture description here
Insert picture description here

B + tree introduction

Insert picture description here

B * tree introduction

Insert picture description here

Expansion: Why is MySQL index more suitable for B + tree?

  • The B + tree is more suitable for external storage, that is, disk storage. Since the internal node has no data field, the position where each node can index is larger and more accurate
  • The pointers of adjacent nodes of the B + tree can greatly increase the accessibility of the interval, which can be used in range query, etc., and the key and data of each node of the B- tree are together, and there is no pointer of the adjacent node, and the interval search cannot be performed
  • Each node of the B-tree saves both data and indexes, so there is very little disk IO, and the B + tree only has leaf nodes to save data, so there are many disk IO
  • As a relational database, MySQL has very strong data correlation, and interval access is a common situation.B + trees are all stored in leaf nodes and are linked together through pointers.It is easy to perform interval traversal or even all traversal.

GitHub: data structure and algorithm source code

Published 83 original articles · Like 23 · Visit 3535

Guess you like

Origin blog.csdn.net/qq_44779506/article/details/105206197