Question: (18 points) Consider the problem of finding required time to finish Tower of Hanoi problem with optimal number of moves recursively. The time takes to

(18 points) Consider the problem of finding required time to finish Tower of Hanoi problem with optimal number of moves recursively. The time takes to move a disk is calculated as the weight of a disk (n) multiplied by the distance between the source and destination pegs (can be 1 or 2). For example, to move disk 2 from peg 1 to peg 3 takes 2"2-4 seconds. Design and implement a Python 3 function that simulates the gameplay by printing each move to console, and at last, prints the total elapsed time for moving each disk separately. Write the function in a python file named TOHtime[StudentID].py Example output 4. Input size is 3 disk 1: SRC to DST disk 2: SRC to AUX disk 1: DST to AUX disk 3: SRC to DST disk 1: AUX to SRC disk 2: AUX to DST disk 1: SRC to DST Elapsed time for disk 1: 6 Elapsed time for disk 2: 4 Elapsed time for disk 3: 6 (18 points) Consider the problem of finding required time to finish Tower of Hanoi problem with optimal number of moves recursively. The time takes to move a disk is calculated as the weight of a disk (n) multiplied by the distance between the source and destination pegs (can be 1 or 2). For example, to move disk 2 from peg 1 to peg 3 takes 2"2-4 seconds. Design and implement a Python 3 function that simulates the gameplay by printing each move to console, and at last, prints the total elapsed time for moving each disk separately. Write the function in a python file named TOHtime[StudentID].py Example output 4. Input size is 3 disk 1: SRC to DST disk 2: SRC to AUX disk 1: DST to AUX disk 3: SRC to DST disk 1: AUX to SRC disk 2: AUX to DST disk 1: SRC to DST Elapsed time for disk 1: 6 Elapsed time for disk 2: 4 Elapsed time for disk 3: 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
