tree.cpp
来自「有关树的遍历问题」· C++ 代码 · 共 30 行
CPP
30 行
#include<iostream>
#include"tree.h"
using namespace std;
void tree(int v)
{
visite(v);
visited[0]=1;
InitQueue(Q);
EnterQueue(Q,v);
while(!Empty(Q))
{
v=DelQueue(Q);
w=Firstadjvex(G,v);
while(w)
{
if(!visited[w])
{
visite(w);
visited[w]=1;
EnterQueue(Q,w);
}
w=Nextadjvex(G,v,w);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?