 
 
 
 
 
   
Homework 5: Graphs and Loose Ends
Handed out Monday, November 28. Due at the start of class Thursday, December 8-NO LATE ACCEPTED.
 nodes.
 nodes.
 is defined to be the minumum number of nodes in an AVL tree of
height
 is defined to be the minumum number of nodes in an AVL tree of
height  , and that
, and that
 
Prove by induction that 
 .
.
 
(This is because
 .)  Using this corollary and Part (ii)
above, show that the worst-case height of an AVL tree with
.)  Using this corollary and Part (ii)
above, show that the worst-case height of an AVL tree with  nodes is
 nodes is 
 (which implies that any search/insert/delete operation will run in
(which implies that any search/insert/delete operation will run in 
 .
.
 that satisfies the given
criteria.  Your graphs should be connected, bidirectional, and
should only consist of a reasonably small number of nodes.
 that satisfies the given
criteria.  Your graphs should be connected, bidirectional, and
should only consist of a reasonably small number of nodes.
 has an Eulerian cycle, but not a Hamiltonian cycle.
 has an Eulerian cycle, but not a Hamiltonian cycle.
 has a Hamiltonian cycle, but not an Eulerian cycle.
 has a Hamiltonian cycle, but not an Eulerian cycle.
 has both an Eulerian and a Hamiltonian cycle.
 has both an Eulerian and a Hamiltonian cycle.
 
def tree_grow(start):
  reached = {}
  fringe = {start}
  while fringe is non-empty:
    curr = "get next node" from fringe
    fringe = fringe - {curr}
    "process" curr
    reached = reached U {curr}
    for all children c of curr:
      if c "is interesting" and c is not in reached:
        fringe = fringe U {c}
For each of the following algorithms, explain how to implement the quoted primatives in the tree-growing algorithm. The first one is done for you:
 , a start node
, a start node  , and an end node
, and an end node  .  You want to construct a relatively efficient
path from
.  You want to construct a relatively efficient
path from  to
 to  , if one exists, but you do not have an exact weight function for edges in the graph.
Instead, you are given a heuristic function
, if one exists, but you do not have an exact weight function for edges in the graph.
Instead, you are given a heuristic function 
 that represents roughly the ``goodness''
of a particular node in terms of how close it is to the solution.  In order to construct your path, you need
to perform a search of nodes in the graph, starting from
 that represents roughly the ``goodness''
of a particular node in terms of how close it is to the solution.  In order to construct your path, you need
to perform a search of nodes in the graph, starting from  , and you want to explore nodes in order, from
highest
, and you want to explore nodes in order, from
highest  to lowest.  (This sort of search algorithm is often used in planning, where the nodes in the
graph represent states, and are not always known at the beginning, but may be generated based on the state you
are currently in by a series of rules).  Please describe how you would implement the following tree-growing
``primitives'' to perform this kind of search:
 to lowest.  (This sort of search algorithm is often used in planning, where the nodes in the
graph represent states, and are not always known at the beginning, but may be generated based on the state you
are currently in by a series of rules).  Please describe how you would implement the following tree-growing
``primitives'' to perform this kind of search:
 and
 and  such that
 such that
 
Note: Giving values of
 and
 and  without any proof will earn zero credit.
Also note that the value of the integrand decreases as
 without any proof will earn zero credit.
Also note that the value of the integrand decreases as  increases.
 increases.
Hint: check the Wikipedia page linked to the course resource page, and feel free
to search a table of integrals if you forget that the antiderivative of  is
 is
 plus a constant, of course.
 plus a constant, of course.
Extra hint from Greg: this problem is hard. Directly applying the integration method (as defined on Wikipedia) will make you a little bit unhappy (try it to find out why). But, one can resolve this by cleverly splitting the summation into two pieces...
 
 
 
 
