Skip to main content

Posts

Showing posts from August 19, 2013

towers of hanoi

Towers Of  Hanoi // to move all disks from peg 1 to peg 3 // you just have to move n-1 disks to peg2 // and then nth disk to peg 3 // and then n-1 disks to peg 3 towers(ndisks,source,temp,destination,) if(ndisks <>0) { towers(ndisks-1,source, destination,temp) move  disk from source to destination towers(ndisks-1,temp,source, destination) }