cws/cw06.tex
changeset 175 32f0928e1e74
parent 174 dd7acea3f9ec
child 265 2692329287bb
equal deleted inserted replaced
174:dd7acea3f9ec 175:32f0928e1e74
    67 step any further from this element.\medskip
    67 step any further from this element.\medskip
    68 
    68 
    69 \noindent
    69 \noindent
    70 The problem is to calculate a sequence of steps to reach the end of
    70 The problem is to calculate a sequence of steps to reach the end of
    71 the list by taking only steps indicated by the integers. For the list
    71 the list by taking only steps indicated by the integers. For the list
    72 above, possible sequence of steps are 3 - 2 - 1 - End, but also 3 - 4
    72 above, possible sequences of steps are 3 - 2 - 1 - End, but also 3 - 4
    73 - End.  This is a recursive problem that can be thought of as a tree
    73 - End.  This is a recursive problem that can be thought of as a tree
    74 where the root is a list and the children are all the lists that are
    74 where the root is a list and the children are all the lists that are
    75 reachable by a single step. For example for the list above this gives a
    75 reachable by a single step. For example for the list above this gives a
    76 tree like
    76 tree like
    77 
    77 
    78 \begin{center}
    78 \begin{center}
    79 \begin{tikzpicture}[grow=right,level distance=30mm,child anchor=north]
    79   \begin{tikzpicture}
       
    80     [grow=right,level distance=30mm,child anchor=north,line width=0.5mm]
    80   \node {[3,4,2,0,1]}
    81   \node {[3,4,2,0,1]}
    81      child {node {[0,1]}}
    82      child {node {[0,1]}}
    82      child {node {[2,0,1]}
    83      child {node {[2,0,1]}
    83         child {node {[1]} child [level distance=13mm] {node {End}}}
    84         child {node {[1]} child [level distance=13mm] {node {End}}}
    84         child {node {[0,1]}}
    85         child {node {[0,1]}}