看板 Grad-ProbAsk 關於我們 聯絡資訊
請問河內塔的recursive algorithm void Hanoi (n:disc,A,B,C:peg) //請問n:disc,C:peg為何意呢? { 又此演算法是用何種程式語言寫的呢? if(n==1) 謝謝大家的幫忙!! { move disc from A to C } else { Hanoi(n-1,A,C,B); move the disc n from A to C; Hanoi(n-1,B,A,C); } } -- 吉他演奏曲 http://blog.xuite.net/iloveguitar/music?st=c&re=list&p=1&w=641095 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.120.221
nowar100:這是虛擬碼 08/24 13:34
fairwarning:請問..所以他不屬於任何程式語言囉?? 08/24 13:38
fairwarning:謝謝 08/24 13:38
pseudocode:<------ 08/24 14:50
chenbojyh:↖ 08/24 15:39
cspy:這原PO可能要看圖才會了解河內塔的用意吧 請參考資料結構~ 08/24 15:49
cspy:看語法是用C 但只是虛擬碼 不能跑 08/24 15:50
yesa315:A B C可以解釋為放盤子的柱子 河內塔定義大盤子要在小盤子 08/24 21:57