lesson 21/05/20 Tree traversal algorithms Flashcards

1
Q

name the 3 ways of traversing a tree

A
  • preorder
  • inorder
  • postorder
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how does preorder work

A

1) visits the root
2) traverses to the left subtree
3) traverses to the right subtree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

how does postorder work

A

1) traverses to the left subtree
2) traverses to the right subtree
3) visits the root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how does inorder work

A

1) traverses to the left subtree
2) visits the root
3) traverses to the right subtree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly