Thursday, July 22, 2010

Depth First Search Procedure.

ALGORITHM : DEPTH - FIRST SEARCH

1. place the starting node in the queue.

2. If the queue is empty, return failure and stop.

3. If the first element on the queue is a goal node g , return succed and stop otherwise.

4. Remove and expand the first element and place the children at the front of the queue.

5. Go back to step 2.



2 comments:

  1. IN DFS WE USE STACK!!! why are you using Queue i dont understand? plz explain?

    ReplyDelete