Function node (value, left, right)

node value

Format:

node (value, left, right)

Input:

number value -
number left -
number right -

Output:

node - None

Properties that reference this function:

find referece to node index in tree [ node (x, index, right), rest ] = True (found left reference)
find referece to node index in tree [ node (x, left, index), rest ] = True (found right reference)
find parent index of [ node (x, index, right), rest ] = i (found parent left)
find parent index of [ node (x, left, index), rest ] = i (found parent right)
result of building the BST from nodes [ n, [ node (a, None, right), others ] ] and moves [ "L", moves ] = result of building the BST from nodes [ node (a, n, right), others ] and moves moves (rebuild BST iterate)
result of building the BST from nodes [ n, [ node (a, left, None), others ] ] and moves [ "R", moves ] = result of building the BST from nodes [ node (a, left, n), others ] and moves moves (rebuild BST iterate 2)
result of rotating (node (v, (node (l, ll, lr)), right)) clockwise = node (l, ll, (node (v, lr, right))) (AVL tree rotate clockwise)
result of rotating (node (v, (node (l, ll, (node (lr, lrl, lrr)))), right)) twice = node (v, (node (lr, (node (l, ll, lrl)), lrr)), right) (AVL tree rotate counter-clockwise)
height of tree (node (v, None, None)) = 1 (height of 1 node)
height of tree (node (v, (node (l, ll, lr)), None)) = (height of tree (node (l, ll, lr))) + 1 (height of left plus 1)
height of tree (node (v, None, (node (r, rl, rr)))) = (height of tree (node (r, rl, rr))) + 1 (height of right plus 1)
output of the bst_delete function where input tree is (node (a, None, None)), value is a, visited is visited, and moves are [ move, rest ] = result of building the BST from nodes visited and moves rest (tree delete leaf)
smallest value in (node (a, (node (l, ll, lr)), right)) = smallest value in (node (l, ll, lr)) (find nearest larger)
smallest value in (node (a, None, right)) = a (find nearest larger finished)
result of updating the root of (node (a, left, right)) with b = node (b, left, right) (update bst root)

Conditional properties that reference this function:

  • if el = val, then index of value val in [ node (el, left, right), remain ] with current index idx = idx (link)
  • if not (el = val), then index of value val in [ node (el, left, right), remain ] with current index idx = index of value val in remain with current index (idx + 1) (link)
  • if the following are true:
    • not (left = val)
    • not (right = val)

    then find parent index of [ node (el, left, right), remain ] = find parent index of remain

    (link)
  • 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:
    • val < a
    • the element at index i of stack tree = node (a, left, right)

    then output of the bst_insert function where input tree is tree, value is val and index is i = output of the bst_insert function where input tree is tree, value is val and index is left

    (link)
  • if the following are true:
    • val > a
    • the element at index i of stack tree = node (a, left, right)

    then output of the bst_insert function where input tree is tree, value is val and index is i = output of the bst_insert function where input tree is tree, value is val and index is right

    (link)
  • if the following are true:
    • val < a
    • the element at index i of stack tree = node (a, (-1), right)

    then output of the bst_insert function where input tree is tree, value is val and index is i = result of storing (node (a, (length of stack tree), right)) at index i of stack (result of appending (node (val, (-1), (-1))) to tree)

    (link)
  • if the following are true:
    • val > a
    • the element at index i of stack tree = node (a, left, (-1))

    then output of the bst_insert function where input tree is tree, value is val and index is i = result of storing (node (a, left, (length of stack tree))) at index i of stack (result of appending (node (val, (-1), (-1))) to tree)

    (link)
  • if the following are true:
    • not (left = index)
    • not (right = index)

    then find referece to node index in tree [ node (x, left, right), rest ] = find referece to node index in tree rest

    (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 (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 (root_val, left, right)
    • the element at index left of stack tree = node (l_val, l_left, g)
    • the element at index g of stack tree = node (g_val, g_left, g_right)

    then result of rotating tree twice = result of storing (node (root_val, g, right)) at index ri of stack (result of storing (node (g_val, left, g_right)) at index g of stack (result of storing (node (l_val, l_left, g_left)) at index left of stack tree))

    (link)
  • if the element at index i of stack tree = node (value, left, right), then find nearest largertree = find nearest largertree (link)
  • if the following are true:
    • val < a
    • the element at index i of stack tree = node (a, (-1), right)

    then find nearest largertree = i

    (link)
  • if the following are true:
    • val < a
    • the element at index i of stack tree = node (a, left, right)

    then find nearest largertree = find nearest largertree

    (link)
  • if the following are true:
    • val > a
    • the element at index i of stack tree = node (a, left, right)

    then find nearest largertree = find nearest largertree

    (link)
  • if the following are true:
    • val = a
    • the element at index i of stack tree = node (a, left, right)

    then find nearest largertree = find nearest largertree

    (link)
  • if the following are true:
    • index of value value in tree = i
    • the element at index i of stack tree = node (value, (-1), (-1))
    • find parent index of tree = p
    • the element at index p of stack tree = node (pval, pleft, i)

    then pop value from tree tree = result of storing (node (pval, pleft, (-1))) at index p of stack tree

    (link)
  • if the following are true:
    • index of value value in tree = i
    • the element at index i of stack tree = node (value, left, (-1))
    • the element at index left of stack tree = node (lvalue, lleft, lright)
    • find parent index of tree = p
    • the element at index p of stack tree = node (pval, pleft, i)

    then pop value from tree tree = result of storing (node (value, (-1), (-1))) at index i of stack (result of storing (node (pval, pleft, left)) at index p of stack tree)

    (link)
  • if the following are true:
    • index of value value in tree = i
    • the element at index i of stack tree = node (value, (-1), right)
    • the element at index right of stack tree = node (rvalue, rleft, rright)
    • find parent index of tree = p
    • the element at index p of stack tree = node (pval, i, pright)

    then pop value from tree tree = result of storing (node (value, (-1), (-1))) at index i of stack (result of storing (node (pval, right, pright)) at index p of stack tree)

    (link)
  • if the following are true:
    • index of value value in tree = i
    • find nearest largertree = n
    • the element at index n of stack tree = node (larger, nleft, nright)
    • the element at index i of stack tree = node (value, left, right)

    then pop value from tree tree = result of storing (node (larger, left, right)) at index i of stack (pop larger from 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

    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)
  • if val < a, then tree (node (a, left, right)) contains val = tree left contains val (link)
  • if val > a, then tree (node (a, left, right)) contains val = tree right contains val (link)
  • if val = a, then tree (node (a, left, right)) contains val = True (link)
  • if val < a, then output of the bst_insert function where the input tree is (node (a, left, right)), value is val, visited is visited, and moves are moves = output of the bst_insert function where the input tree is left, value is val, visited is [ node (a, None, right), visited ], and moves are [ "L", moves ] (link)
  • if val > a, then output of the bst_insert function where the input tree is (node (a, left, right)), value is val, visited is visited, and moves are moves = output of the bst_insert function where the input tree is right, value is val, visited is [ node (a, left, None), visited ], and moves are [ "R", moves ] (link)
  • if val < a, then output of the bst_insert function where the input tree is (node (a, None, None)), value is val, visited is visited, and moves are moves = result of building the BST from nodes [ node (a, (node (val, None, None)), None), visited ] and moves moves (link)
  • if val > a, then output of the bst_insert function where the input tree is (node (a, None, None)), value is val, visited is visited, and moves are moves = result of building the BST from nodes [ node (a, None, (node (val, None, None))), visited ] and moves moves (link)
  • if height of tree left > height of tree right, then height of tree (node (v, left, right)) = (height of tree left) + 1 (link)
  • if height of tree left < height of tree right, then height of tree (node (v, left, right)) = (height of tree right) + 1 (link)
  • if height of tree left = height of tree right, then height of tree (node (v, left, right)) = (height of tree left) + 1 (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)
  • 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)) twice

    (link)
  • if val < a, then output of the bst_delete function where input tree is (node (a, left, right)), value is val, visited is visited, and moves are moves = output of the bst_delete function where input tree is left, value is val, visited is [ node (a, None, right), visited ], and moves are [ "L", moves ] (link)
  • if val > a, then output of the bst_delete function where input tree is (node (a, left, right)), value is val, visited is visited, and moves are moves = output of the bst_delete function where input tree is right, value is val, visited is [ node (a, left, None), visited ], and moves are [ "R", moves ] (link)
  • if val = b, then output of the bst_delete function where input tree is (node (a, (node (b, None, (node (c, cl, cr)))), right)), value is val, visited is visited, and moves are moves = result of building the BST from nodes [ node (a, (node (c, cl, cr)), right), visited ] and moves moves (link)
  • if the following are true:
    • val = a
    • tree = node (a, (node (l, ll, lr)), (node (r, rl, rr)))
    • smallest value in (node (r, rl, rr)) = near

    then output of the bst_delete function where input tree is tree, value is val, visited is visited, and moves are moves = result of building the BST from nodes [ result of updating the root of (result of removing near from tree tree) with near, visited ] and moves moves

    (link)


Comments

Please log in to add comments