看看下面的代码一次,通过澄清我的疑问来帮助我。我已经对我有疑问的每一行发表了我的疑问。此外,它是一个巨大代码的一部分。所以请忽略变量声明和所有。
整个代码运行完美,编译时没有错误。
double Graph::Dijkstra( path_t& path )
{
int* paths = new int[_size];
double min = dijkstra(paths); // **is a function call or not? bcz i didn't found any function in the code**
if(min < 0) { delete[] paths; return -1;}
int i = _size - 1;
while(i>=0)
{
path.push(i); // **when will the program come out of this while loop, i'm wondering how does it breaks?**
i=paths[i];
}
path.push(0);
delete[] paths;
return min;
}
此处提供了完整的编码。