{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

What should be clever prisoner position3m based on the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: be Clever Prisoner Position(3,m) ? Based on the key idea of previous slide there are two cases : 1. Unlucky Position(3,m)>i : 2. Unlucky Position(3,m)<=i : Clever Prisoner Position(3,m)=i Clever Prisoner Position(3,m)=i+1 24 Solving the problem in full generality Let Clever Prisoner Position(n,m) = i. There are two cases : 1. Unlucky Position(n+1,m)>i : Clever Prisoner Position(n+1,m)=i 2. Unlucky Position(n+1,m)<=i : Clever Prisoner Position(n+1,m)=i+1 Solve the problem bottom up using a for loop (the complete code is available on the course webpage, enjoy ...) 25...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online