思想:Node path[MAX_LEN]; //MAX_LEN 取節(jié)點總數(shù)即可int depth;bool Dfs(V) {if( V 為終點){path[depth] = V;return true;}if( V ?為舊點)return false;將V 標記為舊點;path[depth]=V;++depth;對和V 相鄰的每個節(jié)點U {if( Dfs(U) == true)return true;}--depth;return false;}int main(){將所有點都標記為新點;depth = 0;if( Dfs( 起點)) {for(int i = 0;i <= depth; ++ i)cout << path[i] << endl;}}Node節(jié)點怎么寫?????
添加回答
舉報
0/150
提交
取消