- UID
- 412887
- 在线时间
- 0 小时
- 最后登录
- 1970-1-1
- 注册时间
- 2013-3-26
- 宅魂
- 749 点
- 贡献
- 100 点
- 宅币
- 15790 枚
- 灵石
- 0 块
- 元气(技能点)
- 3 点
- 活跃
- 0 ℃
- 听众
- 6
- 收听
- 0
该用户从未签到
第一章
- 积分
- 18487
|

楼主 |
发表于 2013-4-14 11:33:09
|
显示全部楼层
[mw_shl_code=cpp,true]int ListLinksort(LinkList La,LinkList Lb)
{
LinkList temp=new LNode;
while(Lb->next!=NULL&&La->next!=NULL)
{
if(La->next->data<Lb->next->data&&La->next->next==NULL)
{La->next->next=Lb->next;break;}
if(La->next->data<Lb->next->data&&Lb->next->data<=La->next->next->data)
{
temp->next=Lb->next->next;
Lb->next->next=La->next->next;
La->next->next=Lb->next;
Lb->next=temp->next;
}
else if(La->next->data>=Lb->next->data)
{
temp->next=Lb->next->next;
Lb->next->next=La->next;
La->next=Lb->next;
Lb->next=temp->next;
}
La=La->next;
}
}
int Listexchange(LinkList L)
{
LinkList Head=new LNode;
Head=L;
L=L->next;
LinkList x=new LNode;
LinkList y=new LNode;
x=L->next,L->next=NULL,y=L,L=x;
while(L->next!=NULL)
x=L->next,L->next=y,y=L,L=x;
L->next=y;
Head->next=L;
}[/mw_shl_code]
我又笨了。用了2个函数。先从小到大。再逆序。
一开始就从大到小。我怕我会混乱。 |
|