#include
#include
#include
#include
using
typedef
{
int
struct
}node;
//建立单链表
node
{
node
int
head
p
while(cycle)
{
printf("\nplease
scanf("%d",&x);
if(x
{
s
s->data
printf("\n%d",s->data);
p->next
p
}
else
cycle
}
head
p->next
printf("\n
return
}
//单链表测长
int
{
int
node
p
while(p
{
p
n++;
}
return
}
//单链表打印
void
{
node
int
n
printf("\nNow,These
p
if(head
{}
while(p
{
printf("
p
}
}
//单链表删除节点
node
{
node
while((x
{
p2
p1
}
if(x
{
if(p1
{
head
free(p1);
}
else
p2->next
}
else
printf("\n%d
return
}
//单链表插入节点(在第k个节点后插入)
node
{
node
int
L
p1
p0
p0->data
if(k
printf("\nout
for(i=1;
{
p1
}
if(k)
{
p0->next
p1->next
}
else
{
p0->next
head
}
return
}
//单链表从小到大排序
node
{
node
int
int
L
if((head
return
p
for(i=1;
{
p
for(j=i+1;
{
p2
if((p->data)
{
temp
p2->data
p->data
}
p
}
}
return
}
//单链表逆置(仅仅逆置了数据,前驱后继关系没有逆置)
node
{
node
int
int
L
if((head
return
p
for(i=1;
{
p
for(j=i+1;
{
p2
if(1)
{
temp
p2->data
p->data
}
p
}
}
return
}
//单链表逆置(连接顺序逆置)
node
{
node
if((head
return
p1
p2
while(p2)
{
p3
p2->next
p1
p2
}
head->next
head
return
}
//main函数调用测试
int
{
node
a
length(a);
print(a);
printf("\nPlease
int
scanf("%d",&x);
head_del
print(head_del);
printf("\nPlease
int
scanf("%d",&k);
scanf("%d",&y);
printf("\nk
head_ins
print(head_ins);
printf("\nSorting
head_sort
print(head_sort);
printf("\nReversing
//reverse1(head_sort);
//print(head_sort);
head_rev
print(head_rev);
return
}