[**data-structure-typed**](../README.md)

***

[data-structure-typed](../README.md) / AVLTreeNode

# Class: AVLTreeNode\<K, V\>

Defined in: [data-structures/binary-tree/avl-tree.ts:28](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L28)

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

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

Defined in: [data-structures/binary-tree/avl-tree.ts:40](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L40)

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

```ts
get color(): RBTNColor;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:126](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L126)

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

```ts
get count(): number;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:144](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L144)

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

```ts
get familyPosition(): FamilyPosition;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:159](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L159)

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

```ts
get height(): number;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:103](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L103)

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

##### Remarks

Time O(1), Space O(1)

##### Returns

`number`

The height.

#### Set Signature

```ts
set height(value): void;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:113](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L113)

Sets the height of the node.

##### Remarks

Time O(1), Space O(1)

##### Parameters

###### value

`number`

The new height.

##### Returns

`void`

***

### left

#### Get Signature

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

Defined in: [data-structures/binary-tree/avl-tree.ts:53](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L53)

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

```ts
set left(v): void;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:63](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L63)

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`

***

### right

#### Get Signature

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

Defined in: [data-structures/binary-tree/avl-tree.ts:78](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L78)

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

```ts
set right(v): void;
```

Defined in: [data-structures/binary-tree/avl-tree.ts:88](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L88)

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`
