203k views
4 votes
Write the pseudocode for depth first search ? (help plz)

1 Answer

4 votes

Answer:

Start by putting any one of the graph's vertices on top of a stack.

Take the top item of the stack and add it to the visited list.

Create a list of that vertex's adjacent nodes. Add the ones which aren't in the visited list to the top of the stack.

Keep repeating steps 2 and 3 until the stack is empty.

Explanation: i hope it help

User JGurtz
by
5.2k points