Greedy algorithm

Implements

Constructors

Properties

options: GreedyAlgorithmOptions = ...

Methods

  • Calculate differences between start string and end string and return the transformations list

    Parameters

    • startText: string

      The initial string.

    • endText: string

      The resulting string.

    Returns Operation[]

    The list of operations to transform the start string into the end string.

  • Calculate the distance between two strings.

    Parameters

    • start: string

      The initial string.

    • end: string

      The resulting string.

    Returns number

    The number of operations needed to transform the start string into the end string.

  • Recursively find the possibles solutions for the differences between start and end texts

    Parameters

    • start: string

      The initial string.

    • end: string

      The resulting string.

    • unchangedStr: string

      The string that is unchanged between the two strings.

    Returns SubOperations

    The list of operations to transform the start string into the end string.

  • Find the first matching substring between two strings

    Parameters

    • shorter: string

      The initial string.

    • longer: string

      The resulting string.

    • rotation: number

      The rotation value.

    Returns SubOperations

    The first matching substring between the two strings.