Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Breadth-First-Search.md #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions md/Breadth-First-Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ __function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution, or failure
 __if__ problem's initial state is a goal __then return__ empty path to initial state
 _frontier_ ← a FIFO queue initially containing one path, for the _problem_'s initial state
 _reached_ ← a set of states; initially empty
 _solution_ ← failure
 __while__ _frontier_ is not empty __do__
   _parent_ ← the first node in _frontier_
   _path_ ← the first path in _frontier_
   _parent_ ← the last node in _path_
   __for__ _child_ __in__ successors(_parent_) __do__
     _s_ ← _child_.state
     __if__ _s_ is a goal __then__
       __return__ _child_
       __return__ _path_
     __if__ _s_ is not in _reached_ __then__
       add _s_ to _reached_
       add _child_ to the end of _frontier_
 __return__ _solution_
       add _child_ to the end of _path_
       add _path_ to the end of _frontier_
 __return__ _None_

---
__Figure 3.9__ Breadth-first search algorithm.
Expand Down