• Public
  • Public/Protected
  • All

Class RangeSearch<T>

A representation of an inequality that can be used to search and sort the elements of an array into buckets. It is a collection of Points. Each Point will include any values less that its own and, if the point is inclusive, equal to its own.

Type parameters

  • T


  • RangeSearch





Private cf


greater_find_least: boolean = false

True if only one value is kept for elements after the last point. Used to find the inorder successor.

Private Optional last_bucket

last_bucket: string


lesser_find_greatest: boolean = false

True if only one value is kept for elements before the first point. Used to find the inorder predecessor.

Private points

points: Point<T>[] = []



  • all_greater(bucket?: string): void
  • Set the default bucket for any values greater than the last point.


    • Optional bucket: string

    Returns void


  • getBucketInfo(data: T, current?: {}, clear_buckets?: boolean, traverse_left?: () => void): { bucket?: string; left: boolean; right: boolean }
  • A function used by Binary Search Trees to determine traversal.


    • data: T

      The value to compare.

    • Optional current: {}

      The current values that are stored.

      • [key: string]: T[]
    • Default value clear_buckets: boolean = false

      If true, elements from current will be eliminated if they are affected by lesser_find_greatest or greater_find_least and an alternative closer to data is found.

    • Optional traverse_left: () => void

      Will be called when there is the possibility that there are elements smaller than this one that will satisfy greater_find_least, thereby reducing the number of necessary traversals.

        • (): void
        • Returns void

    Returns { bucket?: string; left: boolean; right: boolean }

    An object containing left and right, which are booleans that tell whether more data could be found to the left and right of data, respectively, as well as an optional bucket string to tell where data should be sorted.

    • Optional bucket?: string
    • left: boolean
    • right: boolean


  • push_point(data: T, bucket: string, inclusive?: boolean): void
  • Add a point to the collection.


    • data: T

      The value for comparison.

    • bucket: string

      The bucket to sort values into, or undefined to discard.

    • Default value inclusive: boolean = false

      Determines if the point includes data.

    Returns void


  • search_array(array: T[]): {}
  • Parameters

    • array: T[]

    Returns {}

    • [key: string]: T[]


  • sort(data: T, range_buckets?: {}): {}
  • Parameters

    • data: T
    • Default value range_buckets: {} = {}
      • [key: string]: T[]

    Returns {}

    • [key: string]: T[]

Static gt

Static gteq

Static lt

Static lteq

Generated using TypeDoc