Function result of inserting value to tree tree
tree insert tree
Format:
result of inserting value to tree tree
Input:
list tree -
number value -
Output:
list - None
Properties that reference this function:
result of inserting value to tree tree = output of the bst_insert function where the input tree is tree, value is val, visited is [ ], and moves are [ ] (tree insert convert)
result of AVL insert of tree tree and value value = result of balancing the tree (result of inserting value to tree tree) (AVL tree insert)
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)
Comments
Please log in to add comments