Function Height of a tree tree and index index

Height of a tree tree

Format:

Height of a tree tree and index index

Input:

list tree -
number index -

Output:

number - None

Properties that reference this function:

height of tree tree = Height of a tree tree and index 0 (height help)

Conditional properties that reference this function:

  • if the element at index i of stack tree = node (v, (-1), (-1)), then Height of a tree tree and index i = 1 (link)
  • if the element at index i of stack tree = node (v, left, (-1)), then Height of a tree tree and index i = (Height of a tree tree and index left) + 1 (link)
  • if the element at index i of stack tree = node (v, (-1), right), then Height of a tree tree and index i = (Height of a tree tree and index right) + 1 (link)
  • if the following are true:
    • the element at index i of stack tree = node (v, a, b)
    • Height of a tree tree and index a > Height of a tree tree and index b

    then Height of a tree tree and index i = (Height of a tree tree and index a) + 1

    (link)
  • if the following are true:
    • the element at index i of stack tree = node (v, a, b)
    • Height of a tree tree and index a < Height of a tree tree and index b

    then Height of a tree tree and index i = (Height of a tree tree and index b) + 1

    (link)
  • if the following are true:
    • the element at index i of stack tree = node (v, a, b)
    • Height of a tree tree and index a = Height of a tree tree and index b

    then Height of a tree tree and index i = (Height of a tree tree and index a) + 1

    (link)
  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (rvalue, left, right)
    • Height of a tree tree and index left = Height of a tree tree and index right

    then result of balancing the tree tree = tree

    (link)
  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (rvalue, left, right)
    • Height of a tree tree and index left > (Height of a tree tree and index right) + 1
    • the element at index left of stack tree = node (lvalue, lleft, lright)
    • Height of a tree tree and index lleft > Height of a tree tree and index lright

    then result of balancing the tree tree = result of rotating tree clockwise

    (link)
  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (rvalue, left, right)
    • Height of a tree tree and index left > (Height of a tree tree and index right) + 1
    • the element at index left of stack tree = node (lvalue, lleft, lright)
    • Height of a tree tree and index lleft < Height of a tree tree and index lright

    then result of balancing the tree tree = result of rotating (result of rotating tree twice) clockwise

    (link)


Comments

Please log in to add comments