搜索,备忘录,递推 备忘录的方法 int graph[MAX_NODE_NUM] memset(graph, 0, sizeof(int *MAX_NODE_NUM); shortPath(node)t if (graph[node]= 0) return graph[node] min maXint for =i. child. begin o; j!= i. child. endo:++jt t= shortPath (j; if (t+ length(node, ])< min) min=t+ path(node, 1; graph[node]= min return min;搜索,备忘录,递推 备忘录的方法 int graph[MAX_NODE_NUM]; memset(graph,0,sizeof(int)*MAX_NODE_NUM); shortPath(node) { if (graph[node] != 0) return graph[node]; min = MAXINT; for(j = i.child.begin(); j != i.child.end(); ++j) { t = shortPath(*j); if (t + length(node,*j) < min) min = t + path(node,*j) ; } graph[node] = min; return min; }