[問題] 請教反轉串列
題目如圖http://ppt.cc/Y_2D
看不太懂他的return concatenate(reverse(tail),head)
代表的意思,以下是我的寫法,感覺錯很大
listnode concatenate(listnode *point,listnode *back)
{
listnode forward; //用來指point的下一個node
forward = point.link; //先指到tail的下一個node
point.link = back; //開始反轉
back = point;
point = forward;
return point; //回傳point回reverse
}
還麻煩大大指點一番,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.189.136
→
04/16 15:46, , 1F
04/16 15:46, 1F
→
04/16 16:10, , 2F
04/16 16:10, 2F
→
04/16 16:40, , 3F
04/16 16:40, 3F
討論串 (同標題文章)