University of California, Santa Barbara
Computer Science Department
Data Structures and Algorithms II
CMPSC 130B (Spring 2008)
This material can only be used for UCSB CMPSC 130b Spring 2009 and
you
may print the slides for that purpose (and keep them forever).
This material is protected under the Copyright law and cannot
be copied and/or distributed manually or through electronic means
without written permission from Professor Teofilo F Gonzalez.
In what follows I use W, HS, Sa, AHU, etc. These refer to the books
listed in the class WEB page (first handout
http://www.cs.ucsb.edu/~teo/cs130b.html).
Project Description:
Project (Second Version las modified 4/28/09
6:05 pm) S09
Sample Input File (Output-format-1)
Sample Input File (Output-format-3)
Sample Output File (Output-format 1)
Sample Output File (Output-format 2)
Sample large input file (Output-format-1)
Sample large input file (Output-format-3)
Project Turnin Instructions (plain text)
Description of Samba:
Samba Doc (.pdf)
Note that you only need to use very few of the Samba commands.
Here is an equivalent short version text file:
Samba Doc (.txt) short version
Once you have the file fileout which contains samba instructions
you may see the animation by following the instructions in the
file:
"How to run it (directly in CSIL only)" and
sample animations (.txt)
An example of makefiles is given in:
Makefile Example (.zip)
An Example on How to break classes into files and a sample make file is
given next:
Example of how to break classes into files and sample
make file (W08) (.zip File)
First Homework Assignment S09
Second Homework Assignment S09
First Quiz S09
Second Quiz S09
Three Quiz S09
Solution to HW1 S09 (first page needs to be rotated)
Solution to Mid Term S09
Solution to HW2 S09
Introduction (PDF File)
Introduction. This material came from several places including
Chapter 2 in [W], and Chapters 2 and 3 in [Sa].
Greedy Methods (PDF File)
This material comes from [Sa] pp 662 - 669. Exercise 9 in page
695 is essentially the printer problem. In [W] the printing
problem is in (the first part of) Section 10.1.1.
Conainer Ships
Single Source Shortest Paths(PDF File)
This material comes from [W] pp 339 - 346 (note that d in the
text is dist in fthe slides and p is path) (The typo in
slide sp-6 was corrected).
In [Sa] the material is in 682 - 686 but the notation
is quite different.
The Single Source Shortest Paths algorithm(TXT File)
Single Source Shortest Paths (PDF File)
General Animation of the Single Source Shortest Paths algorithm
Animation of the Single Source Shortest Paths algorithm
Entensions of the Single Source Shortest Paths algorithm(PDF
File)
Spanning Trees(PDF File)
Spanning Trees(PDF File)
The material for spanning trees is from
[Sa] Section 17.3.6.
The correctness proof is in [Sa].
Prim and Kruskal algorithms also appear in [W] Section 9.5.
The code in the slides for Kruskal's algorithm is in
[W].
Kruskal and Prim animations
Bin Packing (PDF File)
In the proof of Theorem 10.2 (k even), S(B2) + S(B3) > 1
should be S(B3) + S(B4) > 1.
This material is from [W] Section 10.1.3
First Fit Animation
Huffman Coding (PDF File)
Huffman Coding (PDF File)
This material is from [Sa] Section 12.6.3. In [W]
Section 10.1.2 also covers Huffman coding.
Huffman coding animation
Divide and Conquer
Divide-and-Conquer (PDF File)
The Counterfit coin material is from Chapter 18 [Sa].
Mergesort is from [Sa} Chapter 18.2.2 and Chapter 7.6 in [W].
The integer multiplication
is from 10.2.4 in [W] (note that in there is for decimal
numbers, but the slides are in binary notation. The idea
is the same.) . We did not cover before the first mid-term
the general proof for
recurrence relations. That proof is from [W] Chapter 10.2.1.
Note that the slides have more details.
Divide and Conquer II
Divide-and-Conquer II(PDF File)
Matrix multiplication is from [W] section 10.2.4. The [Sa]
book also has this, but the products are different from
the ones in the slides. This appears in Example 18.3
(page 707).
Correctness Proof for Strassen's Algorithm
Closest pair data structure example
Dynamic Programming
Dynamic Programming(PDF File)
This material is from [Sa} Chapter 19.1.
Family Vacation DP(PDF File)
This material is not from the textbook. However the
Web contents of the textbook [Sa] has a section on Stack folding
which is very similar to the family vacation problem. That
problem has application in VLSI.
Matrix Product Chain DP(PDF File)
This material is from [Sa] Chapter 19.2.2. It is also in [W]
in Section 10.3.2. The material on Parallel Matrix Product
Chain is not in the textbook, but it is a straight
forward generalization of the (sequential) matrix product chain.
All Pairs shortest paths and
triangulating a convex polygon(PDF File)
This material is essentially
from [Sa] Chapter 19.2.3 and from [W] chapter 10.3.4.
The material on Triangulating a simple polygon
if from the book [AHU]
NP-Completeness (I)
NP-Completeness (II)
NP-Completeness (III)
The NP-completeness material is from [W] Chapter 9.7.
In the [Sa] book it is discussed in several places (check the
index).
Games
See the book [W] Section 10.5.2.
Backtracking, and Branch and Bound
This material is from Chapter 20 and 21 in the [Sa] book.
These twho chapters are on the web
( http://www.cise.ufl.edu/~sahni/dsaac )
Bipartite Matching
In page 380 (exercise 9.13) there is another way to solve
this problem. The material is from [AHU] section 7.5.
Here are two other explanation of the same algorithm.
http://www.mcs.csuhayward.edu/~simon/handouts/4245/hall.html
http://www.comp.nus.edu.sg/~tantc/ioi_training/graph_algorithms.ppt
Knapsack Problem (Approximation Algorithm [S] Section 10.4)
Local Search
OLD STUFF
Old Quizzes, HW and Midterms
Total number of visitors to this page, since 1/1/2001,
is