UCS
===

  ------------------------------------------ -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  ![a small directed graph](ucs-graph.png)      Suppose we perform a UCS on this directed graph starting at vertex `a`, with `b` as the goal. When we first put `b` on the priority queue, what is the cost of the associated path?
  ------------------------------------------ -- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        31
     a ---> b
     
     | \    ^
    5|  \12 |
     |   \  |4
     v    v |

     c ---> d
        6

Suppose we perform a UCS on this directed graph starting at vertex `a`,
with `b` as the goal. When we first put `b` on the priority queue, what
is the cost of the associated path?

a.  4
b.  16
c.  *31*
d.  15

Comparisons in `minIndex`
=========================

For an array of length containing *n* elements, what is the largest
number of comparisons that `minIndex` might perform?

a.  1
b.  n/2
c.  *n-1*
d.  n

Worst-case analysis for selection sort
======================================

What is the worst case for selection sort? That is, what input order on
*n* inputs causes selection sort to make the greatest number of
comparisons?

a.  the input is already sorted
b.  the input is in reverse sorted order
c.  the order {n, 1, 2, ..., n-1}
d.  *selection sort's behavior does not depend upon input order*

Bubble sort swaps
=================

In the worst case, how many swaps will bubble sort make before
competing?

a.  $n / 2$
b.  *$n(n-1) / 2$*
c.  $n(n+1) / 2$
d.  $n^2$

Insertion sort worst case
=========================

What is the worst case for insertion sort? That is, That is, what input
order on *n* inputs causes selection sort to make the greatest number of
comparisons?

a.  the input is already sorted
b.  *the input is in reverse sorted order*
c.  the order {n, 1, 2, ..., n-1}
d.  selection sort's behavior does not depend upon input order

Insertion sort
==============

Suppose we use insertion sort on the list of n items: {2, 3, 4, ...,
n-1, n, 1}. What is the smallest correct O() running time, in terms of
n?

a.  $O(1)$
b.  $O(log\ n)$
c.  *$O(n)$*
d.  $O(n\ log\ n)$
e.  $O(n^2)$

Merge sort runtime
==================

Suppose we alter merge sort so that if the list size is 20 or less, we
use insertion sort rather than recursing. How will this affect the
runtime?

a.  it will improve to $O(n)$
b.  it will take exactly as many steps as before
c.  *it will remain $O(n\ log\ n)$ though the constant factor may change*
d.  it will become $O(n^2)$ because insertion sort is $O(n^2)$

