Sunday 18 January 2009

breadth first search algorithm

procedure breadth_first_search;
begin
OPEN:=[START];
CLOSED:=[ ];

while OPEN<>[ ] do
begin
X := dequeue (OPEN);
if final(X)
then return(success);
else
begin
add X to CLOSED
find successors of X
kill the successors of X that are in CLOSED or OPEN;
enqueue the surviving successors of X into OPEN;
end; {else}
end; {while}

return(failure);
end; {breadth_first_search}

No comments:

Post a Comment