Interface IAbstractBinaryTree<N>
Accessors
root
- get root(): null | N
-
Returns null | N
size
- get size(): number
-
Returns number
visitedId
- get visitedId(): number[]
-
Returns number[]
visitedLeftSum
- get visitedLeftSum(): number[]
-
Returns number[]
visitedNode
- get visitedNode(): N[]
-
Returns N[]
visitedVal
- get visitedVal(): N["val"][]
-
Returns N["val"][]
Methods
BFS
- BFS(): number[]
-
Returns number[]
- BFS(nodeOrPropertyName): number[]
-
Returns number[]
- BFS(nodeOrPropertyName): N["val"][]
-
Parameters
-
nodeOrPropertyName: "val"
Returns N["val"][]
- BFS(nodeOrPropertyName): N[]
-
Parameters
-
nodeOrPropertyName: "node"
Returns N[]
- BFS(nodeOrPropertyName): number[]
-
Parameters
-
nodeOrPropertyName: "count"
Returns number[]
- BFS(nodeOrPropertyName?): AbstractBinaryTreeNodeProperties<N>
-
DFS
- DFS(): number[]
-
Returns number[]
- DFS(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "id"
Returns number[]
- DFS(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "val"
Returns N[]
- DFS(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "node"
Returns N[]
- DFS(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "count"
Returns number[]
- DFS(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties<N>
-
Parameters
-
Optional
pattern: "in" | "pre" | "post"
-
DFSIterative
- DFSIterative(): number[]
-
Returns number[]
- DFSIterative(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "id"
Returns number[]
- DFSIterative(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "val"
Returns N[]
- DFSIterative(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "node"
Returns N[]
- DFSIterative(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "count"
Returns number[]
- DFSIterative(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties<N>
-
Parameters
-
Optional
pattern: "in" | "pre" | "post"
-
add
- add(id, val?): undefined | null | N
-
Parameters
-
id: number | N
-
Optional
val: N["val"]
Returns undefined | null | N
addMany
- addMany(idsOrNodes, data?): (undefined | null | N)[]
-
Parameters
-
idsOrNodes: (null | number | N)[]
-
Optional
data: N["val"][]
Returns (undefined | null | N)[]
clear
- clear(): void
-
Returns void
createNode
- createNode(id, val?, count?): null | N
-
Parameters
-
id: number
-
Optional
val: N["val"]
-
Optional
count: number
Returns null | N
fill
- fill(idsOrNodes, data?): boolean
-
Parameters
-
idsOrNodes: (null | number | N)[]
-
Optional
data: N["val"][] | N[]
Returns boolean
get
- get(nodeProperty, propertyName?): null | N
-
Returns null | N
getDepth
- getDepth(node): number
-
Returns number
getHeight
- getHeight(beginRoot?): number
-
Parameters
-
Optional
beginRoot: null | N
Returns number
getLeftMost
- getLeftMost(): null | N
-
Returns null | N
- getLeftMost(node): N
-
Returns N
- getLeftMost(node?): null | N
-
Returns null | N
getMinHeight
- getMinHeight(beginRoot?): number
-
Parameters
-
Optional
beginRoot: null | N
Returns number
getNodes
- getNodes(nodeProperty, propertyName?, onlyOne?): N[]
-
Parameters
-
nodeProperty: number | N
-
-
Optional
onlyOne: boolean
Returns N[]
getPathToRoot
- getPathToRoot(node): N[]
-
Returns N[]
getPredecessor
- getPredecessor(node): N
-
Returns N
getRightMost
- getRightMost(): null | N
-
Returns null | N
- getRightMost(node): N
-
Returns N
- getRightMost(node?): null | N
-
Returns null | N
getSubTreeSize
- getSubTreeSize(subTreeRoot): number
-
Parameters
-
subTreeRoot: undefined | null | N
Returns number
has
- has(nodeProperty, propertyName?): boolean
-
Returns boolean
isBST
- isBST(): boolean
-
Returns boolean
isEmpty
- isEmpty(): boolean
-
Returns boolean
isPerfectlyBalanced
- isPerfectlyBalanced(beginRoot?): boolean
-
Parameters
-
Optional
beginRoot: null | N
Returns boolean
isSubtreeBST
- isSubtreeBST(node): boolean
-
Returns boolean
levelIterative
- levelIterative(node): number[]
-
Returns number[]
- levelIterative(node, nodeOrPropertyName?): number[]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "id"
Returns number[]
- levelIterative(node, nodeOrPropertyName?): N["val"][]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "val"
Returns N["val"][]
- levelIterative(node, nodeOrPropertyName?): N[]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "node"
Returns N[]
- levelIterative(node, nodeOrPropertyName?): number[]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "count"
Returns number[]
- levelIterative(node, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties<N>
-
listLevels
- listLevels(node): number[][]
-
Returns number[][]
- listLevels(node, nodeOrPropertyName?): number[][]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "id"
Returns number[][]
- listLevels(node, nodeOrPropertyName?): N["val"][][]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "val"
Returns N["val"][][]
- listLevels(node, nodeOrPropertyName?): N[][]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "node"
Returns N[][]
- listLevels(node, nodeOrPropertyName?): number[][]
-
Parameters
-
node: null | N
-
Optional
nodeOrPropertyName: "count"
Returns number[][]
- listLevels(node, nodeOrPropertyName?): AbstractBinaryTreeNodeProperty<N>[][]
-
morris
- morris(): number[]
-
Returns number[]
- morris(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "id"
Returns number[]
- morris(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "val"
Returns N[]
- morris(pattern?, nodeOrPropertyName?): N[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "node"
Returns N[]
- morris(pattern?, nodeOrPropertyName?): number[]
-
Parameters
-
-
Optional
nodeOrPropertyName: "count"
Returns number[]
- morris(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties<N>
-
Parameters
-
Optional
pattern: "in" | "pre" | "post"
-
subTreeAdd
- subTreeAdd(subTreeRoot, delta, propertyName?): boolean
-
Parameters
-
subTreeRoot: N
-
delta: number
-
Returns boolean
subTreeSum
- subTreeSum(subTreeRoot, propertyName?): number
-
Returns number
swapLocation
- swapLocation(srcNode, destNode): N
-
Returns N