哪位达人,看一下,一个按层序遍历森林的办法!该怎么处理

哪位达人,看一下,一个按层序遍历森林的办法!!
例子如下(树以广义表的结构表示):
森林:
(A(B,C(F),D))
(G(H))
如上所述的森林按层次遍历的顺序是AGBCDHF

(1)用C++/C定义你选择的森林的存储结构
(2)利用C++/C实现以上描述的层次遍历森利的算法。
VoidForestTraverse(Forest T,(void)(*visit)(ElemType d))

(3)利用C++/C实现求森林中树的最大高度的函数(如上面的森林最大高度是3)。
int height(Forest T)


------解决方案--------------------
弱弱的问:
广义表表示,具体是怎么存储的呢?
------解决方案--------------------
用队列可以实现层次遍历
任何一种遍历都可以获取树的高度

(实在太难写了。。)
------解决方案--------------------
广搜
// 广度优先遍历
public void bfsTravel() {
for (int i = 0; i < length; i++) {
list[i].visitable = false;
}
bfs();
}

private void bfs() {
Queue queue = new Queue();
for (int index = 0; index < length; index++) {
if (!list[index].visitable) {
queue.addQueue(index);
list[index].visitable = true;
System.out.print(index + " ");
while (!queue.isEmpty()) {
int temp = queue.front();
queue.deleteQueue();
int[] ajd = new int[length];
int ajdlength = list[temp].getAjd(ajd);
for (int i = 0; i < ajdlength; i++) {
int w = ajd[i];
if (!list[w].visitable) {
System.out.print(w + " ");
queue.addQueue(w);
list[w].visitable = true;
}
}
}
}

}
}
广义表表示的