Class BinaryTreeNode<T, FAMILY>

Type Parameters

Hierarchy

Implements

  • IBinaryTreeNode<T, FAMILY>

Constructors

  • The constructor function initializes a BinaryTreeNode object with an id, value, and count.

    Type Parameters

    Parameters

    • id: number

      The id parameter is of type BinaryTreeNodeId and represents the unique identifier for the binary tree node.

    • Optional val: T

      The val parameter is an optional parameter of type T. It represents the value of the binary tree node. If no value is provided, it will be undefined.

    • Optional count: number

      The count parameter is an optional parameter that represents the number of times the value val appears in the binary tree node. If the count parameter is not provided, it defaults to 1.

    Returns BinaryTreeNode<T, FAMILY>

Accessors

Methods

  • The clone function returns a new instance of the FAMILY class with the same id, val, and count properties.

    Returns null | FAMILY

    The clone() method is returning a new instance of the FAMILY class with the same id, val, and count values as the current instance.

  • The function creates a new binary tree node with an optional value and count, and returns it as a specified type.

    Parameters

    • id: number

      The id parameter is the identifier for the binary tree node. It is of type BinaryTreeNodeId, which could be a string or a number depending on how you want to identify your nodes.

    • Optional val: T

      The val parameter is an optional value that can be assigned to the node. It represents the value stored in the node.

    • Optional count: number

      The count parameter is an optional parameter that represents the number of times the value appears in the binary tree node.

    Returns FAMILY

    a new instance of the BinaryTreeNode class, casted as the FAMILY type.

  • The function swaps the location of two nodes in a binary tree.

    Parameters

    • swapNode: FAMILY

      The swapNode parameter is of type FAMILY, which represents a node in a family tree.

    Returns FAMILY

    the swapNode object after swapping its properties with the properties of this object.

Generated using TypeDoc