TreeInsert

TreeInsert[tree,child,pos]

inserts child at position pos in tree.

Details

  • In TreeInsert[tree,child,pos], tree must be a TreeQ object.
  • If expr is not a tree, then TreeInsert[tree,expr,pos] is equivalent to TreeInsert[tree,Tree[expr,None],pos].
  • The following positions can be used for pos:
  • ithe ith child
    -ithe ith child from the end

Examples

Basic Examples  (2)

Insert a leaf with given data into a tree:

Insert a tree:

Wolfram Research (2021), TreeInsert, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeInsert.html.

Text

Wolfram Research (2021), TreeInsert, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeInsert.html.

BibTeX

@misc{reference.wolfram_2021_treeinsert, author="Wolfram Research", title="{TreeInsert}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/TreeInsert.html}", note=[Accessed: 26-September-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_treeinsert, organization={Wolfram Research}, title={TreeInsert}, year={2021}, url={https://reference.wolfram.com/language/ref/TreeInsert.html}, note=[Accessed: 26-September-2021 ]}

CMS

Wolfram Language. 2021. "TreeInsert." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TreeInsert.html.

APA

Wolfram Language. (2021). TreeInsert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeInsert.html