PHD
PHD

Reputation: 685

What is the branching factor of BTreeMap and BTreeSet?

I'm not sure if this is a newbie question.

The rust standard library std::collections provides B-tree implementation of map and set.

I have taken a look at the documentation here, but I could not find the branching factor m used for the implementations.

Upvotes: 2

Views: 372

Answers (1)

Sven Marnach
Sven Marnach

Reputation: 601589

The B-tree implementations use a compile-time constant for the number B, which is current set to 6. This means each internal node has between 6 and 11 children.

The specific number is not part of the interface specification – it's considered an implementation detail. The only way to modify the number is to change it in the source code of the alloc crate.

Upvotes: 4

Related Questions