import {BinarySearchTree} from 'bimsurfer3/viewer/collections/binarysearchtree.js'
BinarySearchTree
Direct Subclass:
Constructor Summary
Public Constructor | ||
public |
constructor(compareFn: *) |
Method Summary
Public Methods | ||
public |
checkInvariants(node: *) |
|
public |
delete(item: *) Delete a key value pair from the Map. |
|
public |
entrySet(): * |
|
public |
get(key: *): * |
|
public |
getKeyValue(key: *): Object Get value for a key |
|
public |
has(key: *): * |
|
public |
inspect(): * |
|
public |
keys(): * |
|
public |
keysAsArray(): * |
|
public |
Insert a key value pair |
|
public |
reCalcHeight(pNode: *) |
|
public |
set(key: *, value: *): * |
|
public |
traverse(node: *, fn: *) Inorder traversal, apply provided function on each visited node |
Public Constructors
public constructor(compareFn: *) source
Params:
Name | Type | Attribute | Description |
compareFn | * | {userCompareFn=}, fn(a,b) return 1 if b>a, -1 if b<a, 0 otherwise |
Public Methods
public checkInvariants(node: *) source
Params:
Name | Type | Attribute | Description |
node | * |
public delete(item: *) source
Delete a key value pair from the Map.
Params:
Name | Type | Attribute | Description |
item | * | {*} key to deleted |
public getKeyValue(key: *): Object source
Get value for a key
Params:
Name | Type | Attribute | Description |
key | * |
public put(key: *, value: *): Object source
Insert a key value pair
Params:
Name | Type | Attribute | Description |
key | * | ||
value | * |
public reCalcHeight(pNode: *) source
Params:
Name | Type | Attribute | Description |
pNode | * |
public traverse(node: *, fn: *) source
Inorder traversal, apply provided function on each visited node
Params:
Name | Type | Attribute | Description |
node | * | {Object=} Start at root if not given |
|
fn | * | {function} Callback function called for every node visited |