Options
All
  • Public
  • Public/Protected
  • All
Menu

Tree class for the AVL Nodes

Hierarchy

Implements

Index

Constructors

constructor

Properties

checkKeyEquality

checkKeyEquality: checkKeyEquality

Default function only checks key validity of number, string, and Date. This function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.

checkValueEquality

checkValueEquality: checkValueEquality

Default function only checks value equality of number, string, and Date. THis function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.

compareKeys

compareKeys: compareKeys

Default function compares only number and string other wise the user will need to supply a custom key comparison function to use this Node Tree model properly.

compareValues

compareValues: compareValues

Default function compares only number and string otherwise the use will need to supply a custom value comparison function to use this Node Tree model properly.

height

height: number = 0

Used to hold the depth of the tree at this point.

type

{number}

key

key: ASNDBS

The key used to find this Node

left

left: AVLNode | null

Holds a child of this type Node as a Node in this type tree.

options

parent

parent: AVLNode | null

Holds the parent of this type Node as a Node in this type tree.

right

right: AVLNode | null

Holds a child of this type Node as a Node in this type tree.

tree

tree: AVLNode

The AVL Tree, accumulation of AVL Nodes.

unique

unique: boolean

set in the constructor to have only unique keys

value

value: SNDBSA

The value this Node holds

Methods

Delete

Private _delete

Private _insert

Private _updateKey

Protected balanceFactor

  • balanceFactor(): number

checkAllNodesFullfillCondition

Protected checkBalanceFactors

  • checkBalanceFactors(): void

Protected checkHeightCorrect

  • checkHeightCorrect(): void

checkInternalPointers

  • checkInternalPointers(): void

checkIsNode

  • checkIsNode(): void

checkNodeOrdering

  • checkNodeOrdering(): void

checkisAVLT

  • checkisAVLT(): void

createLeftChild

createRightChild

createSimilar

executeOnEveryNode

  • executeOnEveryNode(fn: any): any

getAVLNodeFromKey

getEqualityBounds

  • getEqualityBounds(query: INEQuery): boolean

getLowerBoundMatcher

getMaxKey

getMaxKeyDescendant

  • getMaxKeyDescendant<T>(): Node<T>

getMinKey

getMinKeyDescendant

  • getMinKeyDescendant<T>(): Node<T>

getNumberOfKeys

  • getNumberOfKeys(): number

getTreeAsArrayOfArrays

  • getTreeAsArrayOfArrays<T>(): any[]
  • Returns binary tree as an array of arrays. Example: Inserting 0 - 4 keys in AVL tree would return this example with this method. inserts them as they would be seen in the binary tree 1 / \ 0 3 / \ / \ null null 2 4

    [ [ { key: 1, value: [Object] }], [{key: 0, value: [Object]},{key: 3, value: [Object]}], [ null, null, {key: 2, value: [Object]}, {key: 4, value: [Object]}] ]

    Type parameters

    • T

    Returns any[]

getTreeHeight

  • getTreeHeight<T>(tree: Node<T>): number

getUpperBoundMatcher

insert

Protected leftRotation

  • Perform a left rotation of the tree if possible and return the root of the resulting tree The resulting tree's nodes' heights are also updated

    Returns AVLNode

Protected leftTooSmall

query

Protected rebalanceAlongPath

returnThisAVL

  • returnThisAVL(): this

returnThisNode

  • returnThisNode(): this

Protected rightRotation

Protected rightTooSmall

search

toJSON

  • toJSON<T>(): any
  • Turn tree into JSON with an array of objects holding the key and value Requires that key and value can be turned into JSON

    Type parameters

    • T

    Returns any

updateKey

Generated using TypeDoc