Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I implement the following pseudocode of breadth-first search with python 3. Thank you! function breadth first search begin open [Start] closed[ while open

How do I implement the following pseudocode of breadth-first search with python 3. Thank you!

image text in transcribed

image text in transcribed

image text in transcribed

function breadth first search begin open [Start] closed[ while open [] do % initialize % states remain begin remove leftmost state from open, call it X; if X is a goal then return SUCCESS % goal found else begin generate children of X; put X on closed discard children of X if already on open or closed put remaining children on right end of open % loop check % queue return FAIL end % no states left 1. open [A]; closed[ 2. open = [B,C,D]. closed-A 3. open = [C,D,E,F): closed = [BA] 4. open [D,E,F,G,H; closed [C,B,A] 5. open [E,F,G,H,I,J]; closed [D,C,B,A] open = [F,G, H,I,J,K,L]. closed = [E,D,C,B,A] 7. open = [G,H,l,J,K,L,M] (as L is already on open); closed = [F,E,D,C,B,A] 8. open [H,I,J,K,L,M,N]; closed- [G,F,E,D,C,B,A] 9. and so on until either U is found or open [. Assuming the graph is search space function breadth first search begin open [Start] closed[ while open [] do % initialize % states remain begin remove leftmost state from open, call it X; if X is a goal then return SUCCESS % goal found else begin generate children of X; put X on closed discard children of X if already on open or closed put remaining children on right end of open % loop check % queue return FAIL end % no states left 1. open [A]; closed[ 2. open = [B,C,D]. closed-A 3. open = [C,D,E,F): closed = [BA] 4. open [D,E,F,G,H; closed [C,B,A] 5. open [E,F,G,H,I,J]; closed [D,C,B,A] open = [F,G, H,I,J,K,L]. closed = [E,D,C,B,A] 7. open = [G,H,l,J,K,L,M] (as L is already on open); closed = [F,E,D,C,B,A] 8. open [H,I,J,K,L,M,N]; closed- [G,F,E,D,C,B,A] 9. and so on until either U is found or open [. Assuming the graph is search space

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago