lesson 21/05/20 Tree traversal algorithms Flashcards
1
Q
name the 3 ways of traversing a tree
A
- preorder
- inorder
- postorder
2
Q
how does preorder work
A
1) visits the root
2) traverses to the left subtree
3) traverses to the right subtree
3
Q
how does postorder work
A
1) traverses to the left subtree
2) traverses to the right subtree
3) visits the root
4
Q
how does inorder work
A
1) traverses to the left subtree
2) visits the root
3) traverses to the right subtree