热门

最新

红包

立Flag

投票

同城

我的

发布
weixin_51963868
lilstar.
5 年前
trueweixin_51963868

/*插入二叉排序树*/ bstree* InsertBstree(bstree *t, hzpxx ct){ bstree *f = NULL, *p = t; while (p) /*查找插入位置 */ { f = p; /* *f用于保存新结点的最终插入位置*/ p = (ct.price<p->key.price) ? p->lchild : p->rchild; } p = (bstree*)malloc(sizeof(bstree)); /* 生成待插入的新结点*/ p->key.price = ct.price; strcpy(p->key.info, ct.info); {p->key.info[50] = '\0'; } p->lchild = p->rchild = NULL; if (t == NULL) return p; /*原树为空*/ else{ if (ct.price<f->key.price) f->lchild = p; else f->rchild = p; } return t;}
哪位大神可以帮忙解释一下这个?蟹蟹

CSDN App 扫码分享
分享
评论
1
打赏
  • 复制链接
  • 举报
下一条:
奋斗
立即登录