public static BPlusTree <K> BuildGroundUp(int degree, SortedDictionary <K, RecordPointer> elements) { BPlusTree <K> result = new BPlusTree <K>(degree); List <LeafNode> leafs = BuildLevel <LeafNode, RecordPointer>(result, elements); for (int i = 0; i < leafs.Count - 1; i++) { leafs.ElementAt(i).Next = leafs.ElementAt(i + 1); } // build next levels Dictionary <K, LeafNode> leafNodes = leafs.ToDictionary(e => e.GetFirstLeafKey(), e => e); SortedDictionary <K, LeafNode> sortedLeafNodes = new SortedDictionary <K, LeafNode>(leafNodes); SortedDictionary <K, Node> sortedInputNodes = new SortedDictionary <K, Node>(sortedLeafNodes.ToDictionary(e => e.Key, e => (Node)e.Value)); result.Root = BuildUpperLevel <LeafNode>(result, sortedLeafNodes).ElementAtOrDefault(0); return(result); }
public LeafNode(BPlusTree <K> _bptree) { BPTree = _bptree; this.Keys = new List <K>(this.MaxKeys()); this.RecordPointers = new List <RecordPointer>(this.MaxPointers()); }
public InternalNode(BPlusTree <K> _bptree) { BPTree = _bptree; this.Keys = new List <K>(this.MaxKeys()); this.Pointers = new List <Node>(this.MaxPointers()); }
public void SetTree(BPlusTree <K> tree) { Node.BPTree = tree; }