Professional Documents
Culture Documents
Next
# ;<<<<<; ; ; ; ; # ;<<<<<<<; ; ; ; ; # ;<<<<<<<<<; ; ; ; ; # ;<<<<<<<<<<<; ; ; ; ; # ; ; ; ; ; ; # !--------------------------------------------------------------! # ;88888888888888888888888888888888888888888888888888888888888888; # #+ #2 #, # #22222222222222222222222222222222222222222222222222222222222222222# 4<=O>A#A?2@@ # =o parameter passe% to script! 4<BAA>A#A?2@B # C""ega" n)mber of %is's passe% to script! ?o$es2 # 0"oba" $ariab"e ho"%ing n)mber of mo$es! # ?o%ifications to origina" script! %ohanoi() D # #ec)rsi$e f)nction! case E+ in 0) FF 8) %ohanoi /E((E+-+))/ E2 EG E, echo mo$e E2 /--H/ E, "et /?o$es 12 +/ # ?o%ification to origina" script! %ohanoi /E((E+-+))/ EG E, E2 FF esac I case E# in +) case E((E+H0)) in # ?)st ha$e at "east one %is'! +) %ohanoi E+ + , 2 echo /Tota" mo$es 2 E?o$es/ e:it 0F FF 8) echo /E0& i""ega" $a")e for n)mber of %is's/F e:it E4<BAA>A#A?F FF esac FF 8) echo /)sage& E0 =/ echo / Jhere K/=K/ is the n)mber of %is's!/ e:it E4<=O>A#A?F FF esac # # # # # 4:ercises& --------+) Jo)"% comman%s beyon% this point e$er be e:ec)te%L Jhy notL (4asy) 2) 4:p"ain the wor'ings of the wor'ings of the /%ohanoi/ f)nction!
(Aiffic)"t)
Home !p
Next Aliases