{ "q01": { "type": "multiple", "question": "\n\n\nWhich of the following statements regarding spanning trees is true (choose\nall that apply)?\n\n\n", "responses": { "spanning": "In a spanning tree, there is path between any two nodes in the graph.", "acyclic": "Spanning trees are both connected and acyclic.", "single": "There is usually only one way to form a spanning tree.", "minimum": "A minimum spanning tree is a spanning tree that has the least amount of weight as possible.", "maximum": "A maximum spanning tree is a spanning tree that has the most amount of edges as possible.", "unique": "There is usually only one unique minimum spanning tree in a graph.", "greedy": "We can use greedy algorithms to construct minimum spanning trees.", "priority": "To implement Prim's algorithm, we can use a priority queue." } }, "q02": { "type": "blank", "question": "\nComplete the pseudo-code for Prim's Algorithm below\n\n\n
\nPrim(g):\n frontier = []\n marked = {}\n start = g.vertices[0]\n frontier.push((____, ____, ____)) # Add initial node\n\n while not frontier.empty():\n weight, source, target = frontier.pop()\n\n if ____ in ____: # Check if already visited\n continue\n\n marked[____] = ____ # Record visited\n\n for neighbor, cost in g.edges[target]:\n frontier.push((____, ____, ____))\n\n return ____ # Return edges in MST\n\n" }, "q03": { "type": "blank", "question": "\n\n\nA ____ is an ordering of nodes in a ____ graph such that if there is a path\nfrom a node a to node b, then node a appears ____ b in the ordering. An\n____ graph always has at least one such ordering. According to Wikipedia,\nwe can use ____'s algorithm compute this ordering of nodes in a graph.\n\n\n" }, "q04": { "type": "multiple", "question": "\n\n\nGiven the following graph, which of the following orders are topological\nsorts (select all that apply)?\n\n