favoredponcho@lemmy.zip to Programmer Humor@programming.dev · 2 months agoAlgorithms course PTSDlemmy.zipexternal-linkmessage-square25linkfedilinkarrow-up1584arrow-down16
arrow-up1578arrow-down1external-linkAlgorithms course PTSDlemmy.zipfavoredponcho@lemmy.zip to Programmer Humor@programming.dev · 2 months agomessage-square25linkfedilink
minus-squareunmagical@lemmy.mllinkfedilinkarrow-up2·2 months agoYou’re right, how can we simplify that into a usable insite? Prioritize erecting “neat” towers then moving the largest disk not placed in the previous step?
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up3·2 months agoFor each tower of size N, move tower (N - 1) to the non-target position, then move the base to the target position, then move the previously moved tower of size (N - 1) to the target position.
You’re right, how can we simplify that into a usable insite?
For each tower of size N, move tower (N - 1) to the non-target position, then move the base to the target position, then move the previously moved tower of size (N - 1) to the target position.