国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

利用尾插法建立單鏈表 2.設(shè)計(jì)一個(gè)算法,將單鏈表中結(jié)點(diǎn)以逆序排列。逆序的單鏈表中的結(jié)點(diǎn)均為原表中的結(jié)點(diǎn)?

2.設(shè)計(jì)一個(gè)算法,將單鏈表中結(jié)點(diǎn)以逆序排列。逆序的單鏈表中的結(jié)點(diǎn)均為原表中的結(jié)點(diǎn)?Typedef struct listnode{listnode*nextelement data}listnode,

2.設(shè)計(jì)一個(gè)算法,將單鏈表中結(jié)點(diǎn)以逆序排列。逆序的單鏈表中的結(jié)點(diǎn)均為原表中的結(jié)點(diǎn)?

Typedef struct listnode{

listnode*next

element data

}listnode,*plist

這是三種不同的單鏈表逆序算法,兩種遞歸算法和一種非遞歸算法

plist reverselist(plist head){

if(!Head |(Head->next))

return Head

plist pH=reverselist(Head->next)

Head->next->next=Head

Head->next=null

return Head pH

}

plist reverselist(plist Head,plist&tail){

if(!頭| |?。╤ead->next){

tail=head

return head

}

pList pt

pList ph=ReverseList(head->next,pt)

pt->next=head

head->next=NULL

tail=head

return ph

}

pList reverselistunrec(pList head){

if(!頭| |!(head->next))

返回head

pList h=NULL,h1=head

而(head){

h1=head->next

head->next=h

h=head

head=h1

}

返回h

}