Trees Flashcards
Are inorder, preorder, and postorder classed as depth-first search, or breadth first search?
Depth-first search
What kind of traversal is used to delete the tree?
Postorder
Postorder traversal is used to get the _________ expression of an expression tree.
Postfix
Preorder traversal is used to get the _________ expression of an expression tree.
prefix
Postorder traversal can help in ________ collection algorithms, particularly in systems where _____________ is used.
garbage; manual memory management
What order are nodes visited in POSTORDER traversal?
left, right, root
What order are nodes visited in PREORDER traversal?
root, left, right
What order are nodes visited in INORDER traversal?
left, root, right
What kind of traversal is used to create a copy of a tree?
Preorder
Inorder traversal gives nodes in ___________ order.
non-decreasing order
When REVERSED, Inorder traversal gives nodes in ___________ order.
non-increasing
A tree with n nodes has _______ links/edges.
n-1
A tree is a(n) __________ and _________ graph.
undirected; acyclic
(no cycles or loops, every node can be the root node of its own subtree)
What is the level/depth of a tree?
Number of edges along the unique path between a node and the root node
The height of the root node is automatically the _________________________________________________
height of the entire tree itself