單鏈表的就地逆置代碼 什么是單鏈表的逆置?
什么是單鏈表的逆置?例如,鏈表a-> B-> C-> D有頭和尾。局部反轉(zhuǎn)是指:a next=&BB->next=&CC->next=&DD->next=0反轉(zhuǎn)后:B->n
什么是單鏈表的逆置?
例如,鏈表a-> B-> C-> D有頭和尾。局部反轉(zhuǎn)是指:a next=&BB->next=&CC->next=&DD->next=0反轉(zhuǎn)后:B->next=&AC->next=&BD->next=&CA->next=0。所謂局部反轉(zhuǎn)是指在操作過程中遇到a->next=&B時(shí),將其重寫為B->next=&a