中国铁道建设出版
if(head==0) { cout<<" 链表为空!\n" ; return ; }
node *p ;
while( head )
{
}
}
void main( )
{
node *head;
head=create( );
print(head);
head=invert(head);
cout<<"\n逆置后";
print(head);
release(head);
}
6.[程序如下]
#include <iostream.h>
struct Node
{
int x; //围成一圈时,人的序号
Node *next;
};
Node * DelNode(Node *head, int m) //依次输出环形链表中凡报到m者的序号 { Node *p;
int count; if(head==NULL) return head;;
while( head != head->next) //直到链表上只有一个结点为止
{
count=0; while(count < m-2) { count++; head = head->next; p=head; head=head->next ; delete p; cout<<"\n结点空间释放完毕!"; } p=head->next; //删除p所指向的结点 head->next = p->next;