
一道关于树的数据结构算法填空题,求解!!!!
以下函数f34(T)求一棵以孩子—兄弟链表表示的树T的度。请在空缺处填入合适内容,使其成为完整的算法。typedefstructCSNode{ElemTypedata;s...
以下函数f34(T)求一棵以孩子—兄弟链表表示的树T的度。请在空缺处填入合适内容,使其成为完整的算法。
typedef struct CSNode{
ElemType data;
struct CSNode *firstchild, *nextsibling; > *CSTree; //树的二叉链表(孩子—兄弟)存储表示
int f34(CSTree T) {
int d,ds,dt; CSTree p;
if (!T) return ① ;
else{ ds=0; dt=0;
for (p=T->firstchild; p; p=p->nextsibling) {
dt++;
d=f34 ( ② ) ;
if ( ③ ) ds=d;
}
return ds>dt ?( ④ );
} ) 展开
typedef struct CSNode{
ElemType data;
struct CSNode *firstchild, *nextsibling; > *CSTree; //树的二叉链表(孩子—兄弟)存储表示
int f34(CSTree T) {
int d,ds,dt; CSTree p;
if (!T) return ① ;
else{ ds=0; dt=0;
for (p=T->firstchild; p; p=p->nextsibling) {
dt++;
d=f34 ( ② ) ;
if ( ③ ) ds=d;
}
return ds>dt ?( ④ );
} ) 展开
2个回答
展开全部
typedef struct CSNode{
ElemType data;
struct CSNode *firstchild, *nextsibling; > *CSTree; //树的二叉链表(孩子—兄弟)存储表示
int f34(CSTree T) {
int d,ds,dt; CSTree p;
if (!T) return 0;
else{ ds=0; dt=0;
for (p=T->firstchild; p; p=p->nextsibling) {
dt++;
d=f34 ( p ) ;
if ( d>ds ) ds=d;
}
return ds>dt ?( ds );
} )
ElemType data;
struct CSNode *firstchild, *nextsibling; > *CSTree; //树的二叉链表(孩子—兄弟)存储表示
int f34(CSTree T) {
int d,ds,dt; CSTree p;
if (!T) return 0;
else{ ds=0; dt=0;
for (p=T->firstchild; p; p=p->nextsibling) {
dt++;
d=f34 ( p ) ;
if ( d>ds ) ds=d;
}
return ds>dt ?( ds );
} )

2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询