Skip to main content

AVLTreeNode

data-structure-typed


data-structure-typed / AVLTreeNode

Class: AVLTreeNode<K, V>

Defined in: data-structures/binary-tree/avl-tree.ts:29

Represents a Node in an AVL (Adelson-Velsky and Landis) Tree. It extends a BSTNode and ensures the 'height' property is maintained.

Type Parameters

K

K = any

The type of the key.

V

V = any

The type of the value.

Constructors

Constructor

new AVLTreeNode<K, V>(key, value?): AVLTreeNode<K, V>;

Defined in: data-structures/binary-tree/avl-tree.ts:41

Creates an instance of AVLTreeNode.

Parameters

key

K

The key of the node.

value?

V

The value associated with the key.

Returns

AVLTreeNode<K, V>

Remarks

Time O(1), Space O(1)

Accessors

color

Get Signature

get color(): RBTNColor;

Defined in: data-structures/binary-tree/avl-tree.ts:127

Gets the color of the node (used in Red-Black trees).

Remarks

Time O(1), Space O(1)

Returns

RBTNColor

The node's color.


count

Get Signature

get count(): number;

Defined in: data-structures/binary-tree/avl-tree.ts:145

Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).

Remarks

Time O(1), Space O(1)

Returns

number

The subtree node count.


familyPosition

Get Signature

get familyPosition(): FamilyPosition;

Defined in: data-structures/binary-tree/avl-tree.ts:160

Gets the position of the node relative to its parent.

Remarks

Time O(1), Space O(1)

Returns

FamilyPosition

The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').


height

Get Signature

get height(): number;

Defined in: data-structures/binary-tree/avl-tree.ts:104

Gets the height of the node (used in self-balancing trees).

Remarks

Time O(1), Space O(1)

Returns

number

The height.

Set Signature

set height(value): void;

Defined in: data-structures/binary-tree/avl-tree.ts:114

Sets the height of the node.

Remarks

Time O(1), Space O(1)

Parameters
value

number

The new height.

Returns

void


left

Get Signature

get left(): AVLTreeNode<K, V> | null | undefined;

Defined in: data-structures/binary-tree/avl-tree.ts:54

Gets the left child of the node.

Remarks

Time O(1), Space O(1)

Returns

AVLTreeNode<K, V> | null | undefined

The left child.

Set Signature

set left(v): void;

Defined in: data-structures/binary-tree/avl-tree.ts:64

Sets the left child of the node and updates its parent reference.

Remarks

Time O(1), Space O(1)

Parameters
v

AVLTreeNode<K, V> | null | undefined

The node to set as the left child.

Returns

void


Get Signature

get right(): AVLTreeNode<K, V> | null | undefined;

Defined in: data-structures/binary-tree/avl-tree.ts:79

Gets the right child of the node.

Remarks

Time O(1), Space O(1)

Returns

AVLTreeNode<K, V> | null | undefined

The right child.

Set Signature

set right(v): void;

Defined in: data-structures/binary-tree/avl-tree.ts:89

Sets the right child of the node and updates its parent reference.

Remarks

Time O(1), Space O(1)

Parameters
v

AVLTreeNode<K, V> | null | undefined

The node to set as the right child.

Returns

void