『壹』 十万火急,,求助大家帮忙做《数据结构》试题!!!!
你在考电大的数据结构?哇哈哈 和我一样啊 ~~ 程序填空:以下函数是二叉排序树的查找算法,若二叉树为空,则返回根结点的指针,否则,返回值是指向树结点的结构指针p(查找成功p指向查到的树结点,不成功p指向为NULL)完成程序中的空格。typedef struct Bnode{int key;struct Bnode *left;struct Bnode *right;}Bnode;Bnode *Bsearch(Bnode *bt,int k)/*bt用于接收二叉顺序树的根结点的指针,k用于接收要查找的关键字*/{Bnode *p;if (bt==(1)________)return(bt);p=bt;while(p->key!=(2)________){if(k<p->key)(3)_________;else(4)_________;if(p==NULL) break;}Return(5)________;} 以下函数为链队列的出队操作(链队列中带有头结点),出队结点的数据域的值由x返回,front、rear分别是链队列的队头、队尾指针。struct node{ ElemType data; struct node *next;};struct node *front,*rear;ElemType OutQueue(){ ElemType x; if((1)________) { printf("队列下溢错误!\n"); exit(1); } else { struct node *p=front->next; x=p->data; front->next=(2)_________; if(p->next==NULL) rear=front; free(p); (3)________________; }}