Search
Preparing search index...
The search index is not available
gtools
Options
All
Public
Public/Protected
All
Inherited
Externals
Menu
gtools
models/data-structures/binary-tree
BinarySearchTree
Class BinarySearchTree<T>
TODO: add comparator
Type parameters
T
:
number
Hierarchy
BinarySearchTree
Implements
G43Collection
<
T
>
Index
Constructors
constructor
Properties
_length
root
Accessors
length
Methods
add
add
Internally
clear
contains
for
Each
for
Each
Internally
for
Each
Ordered
Internally
remove
remove
Internally
search
search
Internally
Constructors
constructor
new
Binary
Search
Tree<T>
(
rootValue
:
T
)
:
BinarySearchTree
<
T
>
Type parameters
T
:
number
Parameters
rootValue:
T
Returns
BinarySearchTree
<
T
>
Properties
Private
_length
_length
:
number
= 0
root
root
:
null
|
Node
<
T
>
Accessors
length
get
length
(
)
:
number
Returns
number
Methods
add
add
(
newValue
:
T
)
:
void
Parameters
newValue:
T
Returns
void
Private
add
Internally
add
Internally
(
currentNode
:
null
|
Node
<
T
>
, newValue
:
T
)
:
Node
<
T
>
Parameters
currentNode:
null
|
Node
<
T
>
newValue:
T
Returns
Node
<
T
>
clear
clear
(
)
:
void
Returns
void
contains
contains
(
value
:
T
)
:
boolean
Parameters
value:
T
Returns
boolean
for
Each
for
Each
(
callback
:
(
item
:
T
, index
:
number
)
=>
boolean
)
:
void
Parameters
callback:
(
item
:
T
, index
:
number
)
=>
boolean
(
item
:
T
, index
:
number
)
:
boolean
Parameters
item:
T
index:
number
Returns
boolean
Returns
void
for
Each
Internally
for
Each
Internally
(
currentNode
:
null
|
Node
<
T
>
, callback
:
(
item
:
T
, index
:
number
)
=>
boolean
)
:
void
Parameters
currentNode:
null
|
Node
<
T
>
callback:
(
item
:
T
, index
:
number
)
=>
boolean
(
item
:
T
, index
:
number
)
:
boolean
Parameters
item:
T
index:
number
Returns
boolean
Returns
void
for
Each
Ordered
Internally
for
Each
Ordered
Internally
(
currentNode
:
null
|
Node
<
T
>
, callback
:
(
item
:
T
, index
:
number
)
=>
boolean
, order
:
"POST"
|
"PRE"
)
:
void
Parameters
currentNode:
null
|
Node
<
T
>
callback:
(
item
:
T
, index
:
number
)
=>
boolean
(
item
:
T
, index
:
number
)
:
boolean
Parameters
item:
T
index:
number
Returns
boolean
order:
"POST"
|
"PRE"
Returns
void
remove
remove
(
value
:
T
)
:
boolean
Parameters
value:
T
Returns
boolean
Private
remove
Internally
remove
Internally
(
currentNode
:
null
|
Node
<
T
>
, value
:
T
)
:
boolean
Parameters
currentNode:
null
|
Node
<
T
>
value:
T
Returns
boolean
search
search
(
value
:
T
)
:
null
|
Node
<
T
>
Parameters
value:
T
Returns
null
|
Node
<
T
>
Private
search
Internally
search
Internally
(
currentNode
:
null
|
Node
<
T
>
, value
:
T
)
:
null
|
Node
<
T
>
Parameters
currentNode:
null
|
Node
<
T
>
value:
T
Returns
null
|
Node
<
T
>
Modules
models/data-
structures/binary-
tree
Binary
Search
Tree
constructor
_length
root
length
add
add
Internally
clear
contains
for
Each
for
Each
Internally
for
Each
Ordered
Internally
remove
remove
Internally
search
search
Internally
Generated using
TypeDoc
TODO: add comparator