isWellBalanced property
bool
get
isWellBalanced
Returns true if the B+ tree structure is well-balanced.
A well-balanced tree has:
- Branch to leaf ratio < 0.3 (fewer branch pages than leaf pages)
- Tree depth close to optimal for the number of entries
Implementation
bool get isWellBalanced =>
branchToLeafRatio < 0.3 &&
treeDepth <= (log(totalEntries) / log(2)).ceil();