Function result of rotating tree clockwise

tree rotate clockwisetree

Format:

result of rotating tree clockwise

Input:

list tree -

Output:

list - None

Properties that reference this function:

result of rotating (node (v, (node (l, ll, lr)), right)) clockwise = node (l, ll, (node (v, lr, right))) (AVL tree rotate clockwise)

Conditional properties that reference this function:

  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (root_val, left, right)
    • the element at index left of stack tree = node (l_val, l_left, l_right)
    • new_val < root_val
    • new_val < l_val

    then result of inserting new_val to tree tree = result of rotating (output of the bst_insert function where input tree is tree, value is new_val and index is ri) clockwise

    (link)
  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (root_val, left, right)
    • the element at index left of stack tree = node (l_val, l_left, l_right)
    • new_val < root_val
    • new_val > l_val

    then result of inserting new_val to tree tree = result of rotating (result of rotating (output of the bst_insert function where input tree is tree, value is new_val and index is ri) twice) clockwise

    (link)
  • if the following are true:
    • find root index in tree = ri
    • the element at index ri of stack tree = node (root_val, left, right)
    • the element at index left of stack tree = node (l_val, l_left, l_right)

    then result of rotating tree clockwise = result of storing (node (l_val, l_left, ri)) at index left of stack (result of storing (node (root_val, l_right, right)) at index ri of stack 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)
  • if the following are true:
    • height of tree (node (lv, ll, lr)) > (height of tree right) + 1
    • height of tree ll > height of tree lr

    then result of balancing the tree (node (v, (node (lv, ll, lr)), right)) = result of rotating (node (v, (node (lv, ll, lr)), right)) clockwise

    (link)


Comments

Please log in to add comments