【发布时间】:2018-03-13 12:59:53
【问题描述】:
我一直在研究 B-Trees 来存储大约 10k 个字符串数据库,每个字符串都有一个唯一的 id,我认为它可以作为我的密钥。但是我看到的每个实现都只显示 B 树中的键而不是值。我确信 B-Tree 在充当映射时必须将值链接到键,但我无法理解它们是否与键一起存储在树的节点中。例如。
||key3| |key6||
/ | \
/ ||key4| |key5|| \
/ \
||key1| |key2|| ||key7| |key8||
||k3,v3| |k6,v6||
/ | \
/ ||k4,v4||k5,v5|| \
/ \
||k1,v1| |k2,v2|| ||k7,v7| |k8,v8||
我不确定这些值的存储方式和位置。
【问题讨论】:
标签: data-structures tree hashmap b-tree