迷宮問題(記錄路徑)壓棧

上節課數據結構老師最後講的迷宮問題。老師用的方法其實就是深度優先搜索。 這裏用廣度優先搜索解決迷宮問題,順便溫習一下最近學的棧。 用隊列實現廣度優先搜索。 用棧輸出路徑 using namespace std; int maze[5][5],vis[5][5]; int bu[4][2]={1,0,-1,0,0,1,0,-1}; struct node{ int x; int y; int now
相關文章
相關標籤/搜索