1

  1. Six vertices, where each has degree 3.

    graph {
     rankdir=LR
    	a--b,c,d
     c--d
     e--f
     b--c,e
     d--f
     e--f
    }
  2. Six vertices and four edges.

    graph {
     rankdir=LR
    	a--b,c,d,e
     f--b,c,d,e
     e--b,b
     c--d,d
    }
  3. Four edges, and four vertices of degrees respectively. This is not possible as if we add up the degrees of the four vertices, , we need edges to represent all the connections between the vertices. But this is a contradiction the statement says we must use four edges.

    [[Handshaking Theorem]]
     
    $$
    	\Sum 1,2,3,4 = \frac{10}{2} = 5 \text{ edges at minimum}
    $$

2

Hamiltonian:

  • Not Hamiltonian:

3

Look at all the vertices of degree :

  • Consider the length of the path between the vertices of degree
    • to is length
    • to is length
    • to $

Acceptable invariants:

  • : One path of length .
  • : Path of length .

Mapping to :

4

  1. Root:
  2. Internal:
  3. Leaves:
  4. has no children
  5. Parent of is
  6. Siblings of are:
  7. Ancestors of are:
  8. Descendants of are:

5

  1. Construct a BST for the given words.
    graph {
    	node[shape=plain]
     null2,null4,null5,null6,null7[label=""]
     old
     old--never,programmers
     never--die
     programmers--null2,they
     they--their,null4
     die--null5,just
     just--null6,lose
     lose--null7,memories
    }
  2. How many comparisons are required to find or add:
    1. lose: comparisons to find
    2. java: comparisons to add

6

  1. Pre-order traversal:
  2. In-order traversal:
  3. Post-order traversal: