瑞星卡卡安全论坛技术交流区系统软件 请教。二叉树计算深度时程序出错。

1   1  /  1  页   跳转

请教。二叉树计算深度时程序出错。

请教。二叉树计算深度时程序出错。

如题,程序错误出现了显示指针没有指向什么内存单位,调试后。出现的执行框中出现内存读写出错那类,我认为是溢出;子程序如下:请教各位friend帮帮手看看

struct  rnode
{
int data;
struct rnode *lchild,*rchile;
};
typedef stuct rnode N;
void re_pr(N *t)
{
if(t!=NULL)
{
re_pr(t->lchilde);
cout<<t->data;
re_pr(t->rchild);
}
}

其中main用new开了空间后再计算。不知道是错那了。。
还有一题:写出将无向图的邻接表转换成邻接矩阵的算法。
这。我想了好久,头脑有点实了,请帮帮手写写部分提示。部分程序就可以啦。。。
先多谢帮忙。
最后编辑2006-11-25 12:22:11.047000000
分享到:
gototop
 

中序遍歷??
gototop
 

抱歉,请加些注释
gototop
 

struct rnode
{
int data;
struct rnode *lchild,*rchile;
};
typedef stuct rnode N;
void re_pr(N *t)
{
if(t!=NULL)
{
re_pr(t->lchilde
cout<<t->data;
re_pr(t->rchild);
}
}


晕倒,指针名字没写对?
gototop
 
1   1  /  1  页   跳转
页面顶部
Powered by Discuz!NT