Towers of Hanoi • A solution to ToH can be expressed recursively • To move N disks from the original peg to the destination peg: – Move the topmost N-1 disks from the original peg to the extra peg – Move the largest disk from the original peg to the destination peg – Move the N-1 disks from the extra peg to the destination peg • The base case occurs when a peg contains only one disk (N-1 = 1) Java Foundations, 3rd Edition, Lewis/DePasquale/Chase 17 - 37
View full slide show




Towers of Hanoi • To move a stack of N disks from the original peg to the destination peg: – Move the topmost N-1 disks from the original peg to the extra peg – Move the largest disk from the original peg to the destination peg – Move the N-1 disks from the extra peg to the destination peg • The base case occurs when a "stack" contains only one disk 1-29 © 2010 Pearson Addison-Wesley. All rights reserved. 1-29
View full slide show




Towers of Hanoi • To move a stack of N disks from the original peg to the destination peg: – Move the topmost N-1 disks from the original peg to the extra peg – Move the largest disk from the original peg to the destination peg – Move the N-1 disks from the extra peg to the destination peg • The base case occurs when a "stack" contains only one disk Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 10-29
View full slide show




The Towers of Hanoi How it works: n=1 Move disk from peg 1 to peg 3. Done. n=2 Move top disk from peg 1 to peg 2. Move remaining disk from peg 1 to peg 3. Move disk from peg 2 to peg 3. Done. Copyright © 2017, 2014 Pearson Education, Inc. 14-27
View full slide show




The Tower of Hanoi (continued) Solution: Let {Hn} denote the number of moves needed to solve the Tower of Hanoi Puzzle with n disks. Set up a recurrence relation for the sequence {Hn}. Begin with n disks on peg 1. We can transfer the top n −1 disks, following the rules of the puzzle, to peg 3 using Hn−1 moves. First, we use 1 move to transfer the largest disk to the second peg. Then we transfer the n −1 disks from peg 3 to peg 2 using Hn−1 additional moves. This can not be done in fewer steps. Hence, Hn = 2Hn−1 + 1. The initial condition is H1= 1 since a single disk can be transferred from peg 1 to peg 2 in one move.
View full slide show




Industry Speaker Series June 4, 2003 Texas Instruments: E&PS Supply Chain Apr. 10, 2003 Retail Demand and Supply Chain Management – continued Apr. 17, 2003 Softgoods Demand and Supply Chain Management Apr. 7, 2003 Consumer Electronics Supply Chain Management and Case Study – continued Mar. 24, 2003 Consumer Electronics Supply Chain Management and Case Study – continued Feb. 28, 2003 Wireless Data Management and the Supply Chai n Feb. 20, 2003 Retail Demand and Supply Chain Management Feb. 17, 2003 Consumer Electronics Supply Chain Management and Case Study – continued Jan. 31, 2003 Air Cargo Supply Chain Management and Challe nges Unlock the Value in Your Supply Chain Jan. 28, 2003 Lean Design: Using Blitz QFD to Deliver Maximu m for Minimum Contract Manufacturing in China Jan. 27, 2003 Consumer Electronics Supply Chain Management and Case Study June 23, 2004 Supply Chain Management at BlockBuster June 17, 2004 CEO Forum & Agile Seminar Feb. 16, 2004 Inventory Management Nov. 3, 2003 Logistics Planning with i2 Oct. 3, 2003 Trends in Wholesale Inventory Management Sept. 26, 2003 The Art and Science of Consulting Sept. 12, 2003 The Outsourced Supply Chain July 28, 2003 Supply Chain Management with Oracle July 21, 2003 Supply Chain Management with SAP APO July 21, 2003 Filling a Niche in the Consumer Goods Demand Chain July 18, 2003 Dell Site Visit, Austin Texas July 14, 2003 June 23, 2003 Slide 14
View full slide show




Solving towers of Hanoi • In general, for a stack of n disks: – Move n-1 disks from peg 1 to peg 3 – Move 1 disk from peg 1 to peg 2 – Move n-1 disks from peg 3 to peg 2
View full slide show




GGP Peg Jumping Game ; http://games.stanford.edu/gamemaster/games-debug/peg.kif (init (hole a c3 peg)) (init (hole a c4 peg)) … (init (hole d c4 empty)) … (<= (next (pegs ?x)) (does jumper (jump ?sr ?sc ?dr ?dc)) (true (pegs ?y)) (succ ?x ?y)) (<= (next (hole ?sr ?sc empty)) (does jumper (jump ?sr ?sc ?dr ?dc))) … (<= (legal jumper (jump ?sr ?sc ?dr ?dc)) (true (hole ?sr ?sc peg)) (true (hole ?dr ?dc empty)) (middle ?sr ?sc ?or ?oc ?dr ?dc) (true (hole ?or ?oc peg))) … (<= (goal jumper 100) (true (hole a c3 empty)) (true (hole a c4 empty)) (true (hole a c5 empty)) … (succ s1 s2) (succ s2 s3) …
View full slide show




try-throw-catch Mechanism catch( Exception e ) { . . . }   The identifier e in the above catch block heading is called the catch block parameter The catch block parameter does two things: 1. It specifies the type of thrown exception object that the catch block can catch (e.g., an Exception class object above) 2. It provides a name (for the thrown object that is caught) on which it can operate in the catch block – Note: The identifier e is often used by convention, but any non-keyword identifier can be used 11/2010 Copyright © 2008 Pearson Addison-Wesley. All rights reserved 20
View full slide show




try-throw-catch Mechanism catch( Exception e ) { . . . }    The identifier e in the above catch block heading is called the catch block parameter The catch block parameter does two things: 1. It specifies the type of thrown exception object that the catch block can catch (e.g., an Exception class object above) 2. It provides a name (for the thrown object that is caught) on which it can operate in the catch block – Note: The identifier e is often used by convention, but any non-keyword identifier can be used So, it is like an embedded method definition Oct 2010 Copyright © 2008 Pearson Addison-Wesley. All rights reserved 20
View full slide show




Example 6 continued • Starting with n disks on peg 1, we can transfer n-1 disks to peg 3 using Hn-1 moves – It takes 1 move to transfer the largest disk to peg 2 – Then we can move the n-1 disks from peg 3 to peg 2 using another Hn-1 additional moves – So Hn = 2(Hn-1) + 1 with initial condition H1 = 1 (one disk can be transferred in one move) 16
View full slide show




Towers of Hanoi • The top N-1 disks must be moved to peg 2, allowing you to then move the largest disk from peg 1 to peg 3. • You can then move the N-1 disks from peg 2 to peg 3. • Only two pegs are involved in a single move; for this, we’ll employ a helper method, moveOne
View full slide show




HW 2: The Towers of Hanoi ? START GOAL A move consists of taking a disc from the top of a pile of discs on any peg and move it on top of a pile of discs on any other peg. You can never have a disc on top of a larger disc. Let <123,_,_> represent the START condition: All 3 discs are on the left peg, with the largest (1) at the bottom and the smallest (3) on top. The GOAL is <_,_,123>. 1→2 represents a move that takes a disc from peg 1 to peg 2
View full slide show




PEG Ratio 13  This is the ratio of the PE to the growth rate; if the PE is 15 and the growth rate is 7.5%, the PEG is 2.  The belief is that stocks with a PEG>1 are overvalued and PEG<1 are undervalued.  Since this is an equity multiple, the growth rate should be the growth in EPS, not op inc.  If the growth rate used is the forecasted growth over the next year, then the PE ratio should be based on current earnings.  When comparing across firms, the growth rate estimate for all firms should be over the same time period, e.g. forecasted 5-year growth rates.  Fundamentals don’t support the traditional interpretation of the PEG.
View full slide show




From: Essington, 2010, Ecological indicators display reduced variation in North American catch share fisheries. PNAS A growing push to implement catch share fishery programs is based partly on the recognition that they may provide stronger incentives for ecological stewardship than conventional fisheries management. Using data on population status, quota compliance, discard rates, use of habitat-damaging gear, and landings for 15 catch share programs in North America, I tested the hypothesis that catch share systems lead to improved ecological stewardship and status of exploited populations. The average levels of most indicators were unaffected by catch share implementation: only discard rate (*), which declined significantly in catch share fisheries, showed a significant response. These findings suggest that for the indicators examined, the primary effect of catch shares was greater consistency over time. This enhanced consistency could be beneficial to fishery systems and might also be an indication of more effective management.
View full slide show