Quiz #2 prep

First, we will quickly and broadly revise the following concepts/data structures:

Priority Queues  
 - Weighted
 - Unweighted
 - Directed
 - Undirected
Breadth First Search  
Depth First Search  

Then, we will answer the following:

1. Write code to reverse the contents of a Stack using a Queue.

2. Write code to reverse the contents of a Queue using a Stack.

3. Show the BFS and DFS trees obtained by traversing the graph below starting from vertex B.  
Assume that vertices in any "neigbors list" are visited in this order: B E A C D F  
Clearly show the stack/queue states during the algorithm.

4. Briefly explain the invariants essential for insertion sort and selection sort.


Sample Graph