Function index of value n in x

find node n in x and output the index of the value

Format:

index of value n in x

Input:

list x -
any n -

Output:

any - None

Properties that reference this function:

index of value val in els = index of value val in els with current index 0 (Find Node With Value)

Conditional properties that reference this function:

  • 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 index of value value in tree = index, then output of the separate_nodes function where the input tree is tree, the nodes are [ pair (value, weight), rest ], the existing group is exist, and the new group is new = output of the separate_nodes function where the input tree is tree, the nodes are rest, the existing group is [ pair (index, weight), exist ], and the new group is new (link)


Comments

Please log in to add comments