WTF is B-Tree?

You here it all the time, B-Tree this, B-Tree that… what da f*** is it?

It’s a way of storing data in an efficiently sorted way. In this video example of a b-treenumbers are being added to the tree in a sorted way. Larger numbers are on the right, smaller numbers on the left.

Basically, you have some sort of algorithm to decide where the new data goes in the tree. In this case, it’s simply “is the number bigger or smaller”.

Often, trees are “rebalanced”, like in this video, to keep the tree somewhat symmetrical, because it can make the tree more efficient.

Pretty good answer I found on reddit here.

Also on that thread, B-Tree are explained to be “A B-tree is a way of storing large amounts of data in such a way you can search for and retrieve it very quickly.”

And also apparently how they work is “pretty complicated”, so don’t feel bad if you don’t understand! I barely understood it until now!

TL;DR: B-Trees auto sorts & balance the data so they can be retrieved efficiently.


Posted

in

by

Tags: