例如,在河內算法的以下塔:在河內的算法中,什麼是輔助?
input Number of disk
output Print: disk moved successfully
complexity O(n).
Tower(n , beg , aux , end)
1. If (n=1) then
Beg = end;
Return;
2. Call Tower(n-1 , beg ,end , aug);
3. Call Tower (1 ,beg ,aux ,end);
4. Call Tower (n-1,aux ,beg ,end);
什麼是輔助假設來表示?
輔助是第三堆棧。 –