hanq 2008-4-28 13:15
问数据结构(C)的问题!
按权值由小到大的将节点插入装树根的森林单链表中的函数void insert(HP p1,HP*head)
要编写这样的函数 怎么编写?
hanq 2008-4-28 21:52
后来问老师参考了得到的答案!
void insert(HP p1,HP *head)
{HP p;
p=*head;
while(p->next&&p->next->weight<p1->weight)
p=p->next;
p1->next=p->next;
p->next=p1;
}