Options
All
  • Public
  • Public/Protected
  • All
Menu

TODO: add comparator

Type parameters

  • T: number

Hierarchy

  • BinarySearchTree

Implements

Index

Constructors

constructor

Properties

Private _length

_length: number = 0

root

root: null | Node<T>

Accessors

length

  • get length(): number

Methods

add

  • add(newValue: T): void

Private addInternally

  • addInternally(currentNode: null | Node<T>, newValue: T): Node<T>

clear

  • clear(): void

contains

  • contains(value: T): boolean

forEach

  • forEach(callback: (item: T, index: number) => boolean): void

forEachInternally

  • forEachInternally(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

forEachOrderedInternally

  • forEachOrderedInternally(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

Private removeInternally

  • removeInternally(currentNode: null | Node<T>, value: T): boolean

search

  • search(value: T): null | Node<T>

Private searchInternally

  • searchInternally(currentNode: null | Node<T>, value: T): null | Node<T>

Generated using TypeDoc