Wide search BFS ()

  BFS is extremely simple template

. 1  void the BFS (??? ) {
 2      Queue <Node> Q;
 . 3      Node Start, Next;
 . 4      Start = ??? ;
 . 5      q.push (Start);
 . 6      
. 7      the while (! Q.empty ()) {
 . 8          = Start q.front ();
 . 9          q.pop ();
 10          
. 11          // series of operations LSD 
12 is              Next = ??? ;
 13 is              IF (??? ) 
 14                  q.push (Next); 
 15      }
 16 }

 

Guess you like

Origin www.cnblogs.com/0424lrn/p/12241953.html