CSC 301 Grinnell College Fall, 2011
 
Analysis of Algorithms
 

Assignments

Quick Links:   September   October   November   December

The accompanying table indicates assignments and due dates for Computer Science 301 and are subject to the following notes.


Due Date Collaboration Chapters/Sections Problems Notes
Fri., Sept. 2
yes
3
3-4  
Wed., Sept. 7
no
3
3-4 revisions  
Fri., Sept. 9
yes
4.3
Choose 3 of 4.2-1 to 4.3-6  
Wed., Sept. 14
yes
5.1-5.2
5.1-2 (can assume the number of integers in [a, b] is a power of 2), 5.1-3, 5.2-1, one of (5.2-2, 5.2-3, 5.2-4)  
Mon., Sept. 19
yes
6, 7
6.5-7, 6.5-9, 7.4-5  
Wed., Sept. 21
yes
8
8.4-1, 8.4-2, 8-2  
Fri., Sept. 23
no
Hour Test 1  
Wed., Sept. 28
yes
1-8
supplemental problem 1  
Wed., Oct. 5
yes
11
11.3-1, 11.4-1, two of (11.2-1 through 11.2-6)  
Mon., Oct. 10
yes
6
Lab on Pictorial Loop Invariants Reading on Pictorial Loop Invariants
Wed., Oct. 12
yes
6
supplemental problem 2 Solutions with identical PQ.java, PQImplementation.java (Also, PQItem.java identical for array and LinkedList versions)
Wed., Oct. 26
yes
13
supplemental problems 3, 4  
Wed., November 9
no
composite
Take Home Test due  
Fri., November 18
yes
22
2 of (22.1-4, 22.1-5, 22.1-6); 2 of (22.4-2, 22.3-4, 22.2-7)  
Wed., November 23
yes
22, 23
supplemental problem 5
Mon, December 5
no
composite
Take Home Test due  
Due Date Collaboration Chapters/Sections Problems Notes


Supplemental Problems

  1. Comparison of Sorting Algorithms

    In this lab, you are to compare the performance of five sorting algorithms, including:

    In developing the comparison, you will need to code each algorithm in the same programming language (possible choices are Scheme, C, or Java), and you will need to run all algorithms on the same data sets of varying sizes. Here are some details.

    Once you have the times collected for the various algorithms, plot the times versus the data set size using any graphing software you wish. (A spreadsheet might be used, but you also might use MatLab, Maple, or other package.) For each algorithm, the times for the three data sets should be connected (that is, one line would connect the times for the insertion sort with ascending data against sizes 10000, 20000, 40000, ... .)

    If the graphing software allows, it would be helpful to have the graphs for all algorithms with ascending order combined on one plot, the graphs for all algorithms with random data on a second plot, and the graphs for all algorithms with descending data on a third plot. In addition, a graph of a line (f(n)=n) and a quadratic (f(n) = n^2) would be helpful (but not required).

  2. K-way Merge with Priority Queue/Heap

    Exercise 6.5-9 in Cormen et al asks for the development of a K-way merge of sorted lists, using a min-heap (or priority queue). This problem asks you to write a Java program to implement this algorithm. In particular,

  3. Red-Black Tree Insertion: (Patterned after Cormen et al, 13.3-2) Show the red-black tree that results after successively inserting the keys 50, 75, 85, 25, 10, 20, 15, 0 into a tree that was initially null.

  4. Red-Black Tree Deletionion: Consider the following Red-Black Tree:

    Red-Black Tree

    Show the red-black tree that results after successively deleting the keys 5, 26, 38, 40, 56, 80, 90, 50.

  5. Graphs: Consider the weighted, directed graph with:

    When considered as a directed, weighted graph, this gives the following diagram

    directed graph

    In several of the following exercises, the relevant algorithm sometimes allows choices of vertices or edges that meet certain criteria. Whenever there is a choice of vertices, choose the one that comes first in alphabetical order. Whenever there is a choice of edges, choose the edge with initial vertex coming first in alphabetical order; if two edges have the same initial vertex in alphabeticqal order, choose the edge with final vertex coming first in alphabetical order.

    1. Write an adjacency matrix for this directed, weighted graph.
    2. Is this structure connected as a directed graph? Explain briefly.
    3. Is this structure connected as an undirected graph? Explain briefly.
    4. Write the vertices, starting with D, in a form that could be given by a breadth first search.
    5. Considering this as an undirected graph, draw its minimal spanning tree.
    6. Find the path of minimal cost from A to all other vertices.
    7. Can the vertices of this directed graph ordered using a topological sort? Either show the result of a topological sort, or explain why a topological sort cannot be done for this graph.


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~walker/courses/301.fa11/assignments.shtml

created 17 August 2011
last revised 22 October 2011
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.