CS 311: Data Structures II
Winter Quarter
2011
DESCRIPTION
This class is a continuation of CS 260. The topics
covered will include: file I/O in Java, internal and
external sorting algorithms, and graph algorithms and
applications. Prerequisite: CS 260
CRE
CS 311: Winter, 2011
Lab 2
Due: 2/18/11
This lab is practice in reading and writing binary files of integers. There will be an executable
jar file available called FileGenerator.jar. This program will generate binary files of random
integers that can be u
CS 311: Winter 2011
Assignment 1
Due: 2/9/11
This assignment involves profiling sorting algorithms. Profiling an algorithm means testing the
performance of an algorithm on sample data sets as opposed to doing a mathematical analysis of
the algorithm. The
CS 311
Graph Algorithms
Definitions
A Graph G = (V, E) where V is a set of
vertices and E is a set of edges,
An edge is a pair (u,v) where u,v V.
If the edges are ordered the graph is called
directed. Sometimes called a Digraph.
Vertex v is adjacent t
File I/O in Java
CS 311, Winter 2011
File Basics
Recall that a file is block structured. What
does this mean?
What happens when an application opens
or closes a file?
Every OS has its own EOF character and,
for text files, its own EOL character(s).
Str
Revision: 1/19/2011
CS 311, Winter 2011
Sorting Lecture Notes
The Sorting Problem:
Given a set of records r1 , r2 ,., rn with corresponding key values k 1 , k 2 ,., k n , arrange the records
into an order A such that records rA1 , rA 2 ,., rA n have keys
KEY
HOMEWORK 1 — Efﬁciency of Algorithms
PLEASE WRITE YOUR ANSWERS ON THIS SHEET. COPY QUESTIONS FROM THE BOOK AS NEEDED.
Problem 1. For each of the following, simplify or write in closed form if possible.
n—1
\ 50L» 2 2 7.
i=0
Zen + 2)
i=1
n—l
Zi ’
i=1
KEY
HOMEWORK 3 — Graph Algorithms
PLEASE WRITE YOUR ANSWERS ON THIS SHEET. USE EXTRA BLANK PAGES FOR YOUR WORK IF
NEEDED.
Problem 1. Topological Sort: Show in complete detail the execution of a DFSbased Topological Sort
on the following graph. Show your
KTY
HOME.WORK 4

String Data Structures and Algorithms
Pi,BasB wRrrE rrouR ANSwERS oN THrs SHEET. UsB BxrRa BLANK pAGES FoR youR woRK IF
NEEDED.
Problem 1. Ttie
Create a Tlie symbol table from the following word value pairs. Add them one by one, top to
b