1 / 16

Representational Choices

Representational Choices. The Towers of Hanoi Problem. We will consider five Representational Choice for the Towers of Hanoi Problem. Graphical Extensional (Table) Extensional (Descriptive) Recurrence Relation (intensional) Pseudo-code (intensional).

Télécharger la présentation

Representational Choices

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Representational Choices The Towers of Hanoi Problem

  2. We will consider five Representational Choice for the Towers of Hanoi Problem • Graphical • Extensional (Table) • Extensional (Descriptive) • Recurrence Relation (intensional) • Pseudo-code (intensional)

  3. Graphical Representation (Start State)

  4. Graphical Representation (Goal State)

  5. Graphical Representation (Step 1)

  6. Graphical Representation (Step Two)

  7. Graphical Representation (Step 3)

  8. Graphical Representation (Step 4: Isolate “Mr. Big”)

  9. Graphical Representation (Step 5: Unravel from Peg B)

  10. Graphical Representation (Step 6: Assemble on Peg C)

  11. Graphical Representation (Step 7: Finish Assembly on Peg C)

  12. Table Representation

  13. Extensional (Descriptive) Solution • Attachment Towers Image 2: Extensional Solution • For any number of disks, N, if the main goal is to move those N disks from Peg A to Peg C, then you can complete the following steps: • Move N-1 disks to an intermediary peg (B), which takes 2(N-1) – 1 moves (e.g., for three disks, move two disks (2^2 – 1 moves = 3 moves) to peg B). • Move the biggest disk from Peg A to Peg C (the Goal). • Move the N-1 disks from Peg B to Peg C (the Goal, which takes three more moves). • In total, you need 7 moves for 3 discs, 15 moves for 4 disks, 31 moves (15 + 15 + 1) for 5 disks, 63 moves (31 + 31 + 1) for 6 disks, etc.

  14. Representational Choices (4 Recurrence Relation (Intensional) • T(1) = 1 • T(N) = 2 T (N-1) + 1 • Which has solution T(N) = 2^N -1.

  15. Representational Choices: Pseudo-Code (intensional, RECURSIVE) • n is the number of disks • Start is the start peg • int is the intermediate peg • Dest is the goal or destination peg • TOH (n, Start, Int, Dest) • If n = 1 then move disk from Start to Dest • Else TOH(n-1, Start, Dest, Int) • TOH(1, Start, Int, Dest) • TOH(n-1, Int, Start, Dest)

  16. SUMMARY • Note that each of these intentional representations is also an example of problem reduction. A problem that seemed large and complex has been broken down into smaller, manageable problems whose solution can be carried out and is understandable to the problem-solver.

More Related