InnerNode
Extends:
An Inner Node in the B+Tree.
Constructor Summary
Public Constructor | ||
public |
constructor(keys: Array<*>, nodePointers: Array<Node>) Creates a new inner node. |
Member Summary
Public Members | ||
public get |
nodePointers: Array<Node> |
Method Summary
Public Methods | ||
public |
Adds a key corresponding to a new child node to this inner node. |
|
public |
getItem(key: *): number Searches the node for a specific key and returns the matching child's position. Since the B+tree limits the number of records per leaf node, the complexity of this method is in O([(order-1)/2, order-1]). |
|
public |
isLeaf(): boolean Returns whether this is a leaf node. |
|
public |
Merges two inner nodes together (this + frNod). |
|
public |
Splits the node into two nodes (this + one new node). |
Public Constructors
public constructor(keys: Array<*>, nodePointers: Array<Node>) source
Creates a new inner node. The only key values that appear in the internal nodes are the first key values from each leaf, with the exception of the key from the very first leaf which isn't included. Each key value that appears in the internal nodes only appears once.
Params:
Name | Type | Attribute | Description |
keys | Array<*> |
|
The first key of each child node (except for the first one). |
nodePointers | Array<Node> |
|
The pointers to the child nodes. |
Public Methods
public addKey(key: *, ptrL: Node, ptrR: Node): number source
Adds a key corresponding to a new child node to this inner node. By definition, the key is inserted into the keys of this leaf node, such that the ascending order of the keys is maintained.
Return:
number | The position it was inserted at. |
public getItem(key: *): number source
Searches the node for a specific key and returns the matching child's position.
Since the B+tree limits the number of records per leaf node, the complexity of this method is in O([(order-1)/2, order-1]).
Params:
Name | Type | Attribute | Description |
key | * | The key to look for. |
Return:
number | The index of the match. |
public isLeaf(): boolean source
Returns whether this is a leaf node.
Return:
boolean | False, since it is an inner node. |