Graph and Tree Traversal methods Flashcards

1
Q

what are the two ways of traversing a graph

A

depth first approach, breadth first approach

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

what is the method of conducting a depth first approach on a graph

A

travel down each branch then nachtrack

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

what is the method of conducting a breadth first approach on a graph

A

look at all the connection on a node then travel to the next node

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

does the order of nodes when traversing a graph matter

A

no, they will acheive the same purpose

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

what are the three methods of traversing a tree

A

preorder traversal, inorder traversal, postorder traversal

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

what is the method of conducting a preorder approach on a tree

A

it is a top down traversal method, where the roots is met first

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

what is the method of conducting a inorder approach on a tree

A

left to right traversal method, where the root is met in the middle step

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

what is the method of conducting a postorder approach on a tree

A

bottom up traversal method, where the root is met last

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

how can the order be worked out by using dots

A

after placing the dots a line is drawn anticlockwise and any dot that connects is recorded, for preorder dots are on the left, inorder has them below and for post order they are to the right

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