/*插入二叉排序树*/ 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;}
哪位大神可以帮忙解释一下这个?蟹蟹