Computational Time Required to Solve the Tower of Hanoi - PowerPoint PPT Presentation

1 / 2
About This Presentation
Title:

Computational Time Required to Solve the Tower of Hanoi

Description:

Computational Time Required to. Solve the Tower of Hanoi. To solve the Tower of Hanoi problem, a recursive approach was taken. ... – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 3
Provided by: Joe487
Category:

less

Transcript and Presenter's Notes

Title: Computational Time Required to Solve the Tower of Hanoi


1
Computational Time Required to Solve the Tower
of Hanoi
  • To solve the Tower of Hanoi problem, a recursive
    approach was taken. To move n disk from one tower
    to another we first move (n-1) disk to an
    auxiliary tower, then move the bottom disk to its
    final destination, and then move the (n-1) disk
    to their final destination.
  • The time required for various operations was
    measure and any overhead not associated with the
    function was subtracted out.
  • 1E9 Operations were performed on a Pentium(4)
    running at 2400.153 MHz. The times required for a
    single operation are as follows
  • To call the function (w/o performing any
    operations)
  • Tf 5.171/1E9 s
  • To move a single disk w/ necessary bookkeeping
  • T1 14.157/1E9 s
  • To compute auxiliary tower and pass over n1
    case
  • Taux 2.742/1E9 s

2
Computational Time Required to Solve the Tower
of Hanoi
  • Now a recursive relationship can be written and
    solved for the time as a function of n
  • Let Tn be the time required to solve problem
    for n disks then
  • Tn Tf Taux 2Tn-1 T1
  • C 2 Tn-1 (letting C Tf Taux T1 )
  • C 2 (C 2 Tn-2)
  • C 2 (C 2 (C 2 Tn-3)
  • C 2C 22C 2(k-1)C 2k Tn-k (In
    general)
  • C (2k 1) 2k Tn k
  • C (2(n-1) 1) 2(n-1)T1 By n 1 ? k
  • Substituting the times found earlier
  • T64 2.036E11 1.306E11 3.342E11 s or
    10,590 years
Write a Comment
User Comments (0)
About PowerShow.com