# IAbstractBinaryTree | data-structure-typed
Documentation for data-structure-typed

# Interface IAbstractBinaryTree<N>

#### Type Parameters

- #### N extends AbstractBinaryTreeNode <N["val"], N>

#### Hierarchy

- IAbstractBinaryTree

#### Implemented by

- AbstractBinaryTree

- Defined in src/interfaces/abstract-binary-tree.ts:42

#####
Index

### Accessors

loopType
root
size
visitedId
visitedLeftSum
visitedNode
visitedVal

### Methods

BFS
DFS
DFSIterative
add
addMany
clear
createNode
fill
get
getDepth
getHeight
getLeftMost
getMinHeight
getNodes
getPathToRoot
getPredecessor
getRightMost
getSubTreeSize
has
isBST
isEmpty
isPerfectlyBalanced
isSubtreeBST
levelIterative
listLevels
morris
remove
subTreeAdd
subTreeSum
swapLocation

## Accessors

### loopType

- get loopType(): LoopType

- #### Returns LoopType

  - Defined in src/interfaces/abstract-binary-tree.ts:45

### root

- get root(): null | N

- #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:55

### size

- get size(): number

- #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:57

### visitedId

- get visitedId(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:47

### visitedLeftSum

- get visitedLeftSum(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:53

### visitedNode

- get visitedNode(): N[]

- #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:51

### visitedVal

- get visitedVal(): N["val"][]

- #### Returns N["val"][]

  - Defined in src/interfaces/abstract-binary-tree.ts:49

## Methods

### BFS

- BFS(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:113
- BFS(nodeOrPropertyName): number[]

- #### Parameters

  - ##### nodeOrPropertyName: "id"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:115
- BFS(nodeOrPropertyName): N["val"][]

- #### Parameters

  - ##### nodeOrPropertyName: "val"

  #### Returns N["val"][]

  - Defined in src/interfaces/abstract-binary-tree.ts:117
- BFS(nodeOrPropertyName): N[]

- #### Parameters

  - ##### nodeOrPropertyName: "node"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:119
- BFS(nodeOrPropertyName): number[]

- #### Parameters

  - ##### nodeOrPropertyName: "count"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:121
- BFS(nodeOrPropertyName?): AbstractBinaryTreeNodeProperties <N>

- #### Parameters

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperties <N>

  - Defined in src/interfaces/abstract-binary-tree.ts:123

### DFS

- DFS(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:125
- DFS(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "id"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:127
- DFS(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "val"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:129
- DFS(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "node"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:131
- DFS(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "count"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:133
- DFS(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties <N>

- #### Parameters

  - ##### `Optional` pattern: "in" | "pre" | "post"

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperties <N>

  - Defined in src/interfaces/abstract-binary-tree.ts:135

### DFSIterative

- DFSIterative(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:137
- DFSIterative(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "id"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:139
- DFSIterative(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "val"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:141
- DFSIterative(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "node"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:143
- DFSIterative(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "count"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:145
- DFSIterative(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties <N>

- #### Parameters

  - ##### `Optional` pattern: "in" | "pre" | "post"

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperties <N>

  - Defined in src/interfaces/abstract-binary-tree.ts:147

### add

- add(id, val?): undefined | null | N

- #### Parameters

  - ##### id: number | N

  - ##### `Optional` val: N["val"]

  #### Returns undefined | null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:65

### addMany

- addMany(idsOrNodes, data?): (undefined | null | N)[]

- #### Parameters

  - ##### idsOrNodes: (null | number | N)[]

  - ##### `Optional` data: N["val"][]

  #### Returns (undefined | null | N)[]

  - Defined in src/interfaces/abstract-binary-tree.ts:67

### clear

- clear(): void

- #### Returns void

  - Defined in src/interfaces/abstract-binary-tree.ts:61

### createNode

- createNode(id, val?, count?): null | N

- #### Parameters

  - ##### id: number

  - ##### `Optional` val: N["val"]

  - ##### `Optional` count: number

  #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:43

### fill

- fill(idsOrNodes, data?): boolean

- #### Parameters

  - ##### idsOrNodes: (null | number | N)[]

  - ##### `Optional` data: N["val"][] | N[]

  #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:69

### get

- get(nodeProperty, propertyName?): null | N

- #### Parameters

  - ##### nodeProperty: number | N

  - ##### `Optional` propertyName: BinaryTreeNodePropertyName

  #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:85

### getDepth

- getDepth(node): number

- #### Parameters

  - ##### node: N

  #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:73

### getHeight

- getHeight(beginRoot?): number

- #### Parameters

  - ##### `Optional` beginRoot: null | N

  #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:75

### getLeftMost

- getLeftMost(): null | N

- #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:89
- getLeftMost(node): N

- #### Parameters

  - ##### node: N

  #### Returns N

  - Defined in src/interfaces/abstract-binary-tree.ts:91
- getLeftMost(node?): null | N

- #### Parameters

  - ##### `Optional` node: null | N

  #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:93

### getMinHeight

- getMinHeight(beginRoot?): number

- #### Parameters

  - ##### `Optional` beginRoot: null | N

  #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:77

### getNodes

- getNodes(nodeProperty, propertyName?, onlyOne?): N[]

- #### Parameters

  - ##### nodeProperty: number | N

  - ##### `Optional` propertyName: BinaryTreeNodePropertyName

  - ##### `Optional` onlyOne: boolean

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:81

### getPathToRoot

- getPathToRoot(node): N[]

- #### Parameters

  - ##### node: N

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:87

### getPredecessor

- getPredecessor(node): N

- #### Parameters

  - ##### node: N

  #### Returns N

  - Defined in src/interfaces/abstract-binary-tree.ts:176

### getRightMost

- getRightMost(): null | N

- #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:95
- getRightMost(node): N

- #### Parameters

  - ##### node: N

  #### Returns N

  - Defined in src/interfaces/abstract-binary-tree.ts:97
- getRightMost(node?): null | N

- #### Parameters

  - ##### `Optional` node: null | N

  #### Returns null | N

  - Defined in src/interfaces/abstract-binary-tree.ts:99

### getSubTreeSize

- getSubTreeSize(subTreeRoot): number

- #### Parameters

  - ##### subTreeRoot: undefined | null | N

  #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:105

### has

- has(nodeProperty, propertyName?): boolean

- #### Parameters

  - ##### nodeProperty: number | N

  - ##### `Optional` propertyName: BinaryTreeNodePropertyName

  #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:83

### isBST

- isBST(): boolean

- #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:103

### isEmpty

- isEmpty(): boolean

- #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:63

### isPerfectlyBalanced

- isPerfectlyBalanced(beginRoot?): boolean

- #### Parameters

  - ##### `Optional` beginRoot: null | N

  #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:79

### isSubtreeBST

- isSubtreeBST(node): boolean

- #### Parameters

  - ##### node: null | N

  #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:101

### levelIterative

- levelIterative(node): number[]

- #### Parameters

  - ##### node: null | N

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:152
- levelIterative(node, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "id"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:154
- levelIterative(node, nodeOrPropertyName?): N["val"][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "val"

  #### Returns N["val"][]

  - Defined in src/interfaces/abstract-binary-tree.ts:156
- levelIterative(node, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "node"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:158
- levelIterative(node, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "count"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:160
- levelIterative(node, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties <N>

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperties <N>

  - Defined in src/interfaces/abstract-binary-tree.ts:162

### listLevels

- listLevels(node): number[][]

- #### Parameters

  - ##### node: null | N

  #### Returns number[][]

  - Defined in src/interfaces/abstract-binary-tree.ts:164
- listLevels(node, nodeOrPropertyName?): number[][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "id"

  #### Returns number[][]

  - Defined in src/interfaces/abstract-binary-tree.ts:166
- listLevels(node, nodeOrPropertyName?): N["val"][][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "val"

  #### Returns N["val"][][]

  - Defined in src/interfaces/abstract-binary-tree.ts:168
- listLevels(node, nodeOrPropertyName?): N[][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "node"

  #### Returns N[][]

  - Defined in src/interfaces/abstract-binary-tree.ts:170
- listLevels(node, nodeOrPropertyName?): number[][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: "count"

  #### Returns number[][]

  - Defined in src/interfaces/abstract-binary-tree.ts:172
- listLevels(node, nodeOrPropertyName?): AbstractBinaryTreeNodeProperty <N>[][]

- #### Parameters

  - ##### node: null | N

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperty <N>[][]

  - Defined in src/interfaces/abstract-binary-tree.ts:174

### morris

- morris(): number[]

- #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:178
- morris(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "id"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:180
- morris(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "val"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:182
- morris(pattern?, nodeOrPropertyName?): N[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "node"

  #### Returns N[]

  - Defined in src/interfaces/abstract-binary-tree.ts:184
- morris(pattern?, nodeOrPropertyName?): number[]

- #### Parameters

  - ##### `Optional` pattern: DFSOrderPattern

  - ##### `Optional` nodeOrPropertyName: "count"

  #### Returns number[]

  - Defined in src/interfaces/abstract-binary-tree.ts:186
- morris(pattern?, nodeOrPropertyName?): AbstractBinaryTreeNodeProperties <N>

- #### Parameters

  - ##### `Optional` pattern: "in" | "pre" | "post"

  - ##### `Optional` nodeOrPropertyName: NodeOrPropertyName

  #### Returns AbstractBinaryTreeNodeProperties <N>

  - Defined in src/interfaces/abstract-binary-tree.ts:188

### remove

- remove(id, ignoreCount?): BinaryTreeDeletedResult <N>[]

- #### Parameters

  - ##### id: number

  - ##### `Optional` ignoreCount: boolean

  #### Returns BinaryTreeDeletedResult <N>[]

  - Defined in src/interfaces/abstract-binary-tree.ts:71

### subTreeAdd

- subTreeAdd(subTreeRoot, delta, propertyName?): boolean

- #### Parameters

  - ##### subTreeRoot: N

  - ##### delta: number

  - ##### `Optional` propertyName: BinaryTreeNodePropertyName

  #### Returns boolean

  - Defined in src/interfaces/abstract-binary-tree.ts:111

### subTreeSum

- subTreeSum(subTreeRoot, propertyName?): number

- #### Parameters

  - ##### subTreeRoot: N

  - ##### `Optional` propertyName: BinaryTreeNodePropertyName

  #### Returns number

  - Defined in src/interfaces/abstract-binary-tree.ts:109

### swapLocation

- swapLocation(srcNode, destNode): N

- #### Parameters

  - ##### srcNode: N

  - ##### destNode: N

  #### Returns N

  - Defined in src/interfaces/abstract-binary-tree.ts:59

Generated using TypeDoc