Skip to content

bplustree

general · scripts/general/bplustree.m

: t = bplustree ()
: t = bplustree (order)

In-memory B+ tree sorted key-value store.

t = bplustree () creates an empty B+ tree with default node capacity Order = 32 (maximum keys per leaf / internal node). t = bplustree (ORDER) sets that capacity; order must be an even integer \ge 4.

Methods:

  • insert (t, key, value) – insert or overwrite a key
  • [value, tf] = lookup (t, key) – fetch a value; tf is true when the key exists
  • tf = isKey (t, key) – membership test
  • remove (t, key) – delete a key if present
  • k = keys (t) – sorted column of keys
  • v = values (t) – values in key order (cell row)

Keys must be real finite numeric scalars (logical / integer / single / double). Values may be any type. The tree is a handle: copies of t refer to the same store. Read-only properties: Count, Order.

Behaviour note (MATLAB R2026a): MathWorks does not ship a public bplustree / BPlusTree API (exist ('bplustree') is 0). Closest core sorted maps are containers.Map (keys returned sorted) and dictionary. This Nexus API exposes an explicit in-memory B+ tree for sorted key-value workloads, including a 100k insert/lookup acceptance case (nexus#1947, nw alg-008).