CSci 2101 Data Structures -- Resources.
[Home]
[Syllabus]
[Labs]
[Assignments]
[Resources]
[CSci
2101 Wiki page]
This page contains handouts for the course, code samples, and links to
other helpful materials. The materials will be added as needed.
Installing Java
The instructions are for a Windows machine. Most of the installation
for Mac is similar, and most of the pages linked below have
documentation for Mac. If you run into any problems, please let me
know.
- You can
download J2SE version 1.5 (a.k.a. version 5.0) from java.sun.com
(It's a free download). Click on download JDK, select "Accept"
for the license agreement on the next page, and then choose an
installation (both Online and Offline installation for Windows should
work).
If you already have Java installed, make sure that it is version 1.5
- In order to access Java compiler and java virtual machine, you
need to add the path to these programs to the variable PATH on your
computer:
- Find out the path to javac on your computer (you may do a search on
javac). On my machine it's
C:\Program Files\Java\jdk1.5.0_01\bin
- Open Control Panel, double-click on System, go to advanced, and
choose Environment Variables.
- Scroll down the list of variables. Find
Path
, click
on it, and click the button Edit. A narrow window will open which will
show a long string of symbols -- the current value of Path.
- Carefully move the cursor to the end of the string. Make sure not
to overwrite anything in the string. At the very end add the path that
you have found in part 1 preceded by semicolon. In my case it would be
;C:\Program Files\Java\jdk1.5.0_01\bin
- Click OK to close the little window.
- jEdit is the text editor that we will be using. You may obtain it
from www.jedit.org (also a free
download). You need to install Java before you can install jEdit.
- Documentation
for various Java tools (javac, java, appletviewer) might be helpful.
Java resources
- Language
Essentials Short Course. Fairly easy to read, a good source for a
new Java programmer. Also, check out New to Java
Center: it's helpful in explaining general principles, but most
examples focus on applets and graphics. Both sources are from sun.com.
- APIs
for Java 1.5. Java APIs (lists and descriptions of
Java pre-defined classes and methods)
will become your most frequently used source of Java information from
this class on. Finding necessary information in APIs is not easy at
first. The ability to orient oneself in APIs is one of the most
important skills that you will learn in this class.
- Java
tutorials at sun.com are another source of information that you
need to be familiar with. They answer most "How do I..."
questions, though sometimes not in a straightforward way. Getting
oriented in Java tutorials will be helpful to you for many years to
come.
- The resources page for
CSci 1211 (a Java course for non-CSci majors) has a lot of Java
examples, links, and excercises. CSci 1211 focuses more on applets,
graphics, and interactive programs than this class does, so the page
might be helpful if you want to play with Java on your own. Note
that Csci 1211 uses Java 1.4 which is substantially different from
the current version 1.5.
In-class examples
- Jan. 19: The first java program,
examples of using variables.
- Jan. 26: if/else statement, Java
booleans, while loop.
- Jan. 26: Using stack of characters,
queue of characters.
- Jan. 28: Application of queues: The packaging problem.
Two solutions from last
semester, similar to what we came up with in class, but with some
interesting differences.
- Jan. 31: Exercise on while
loops. Other kinds of loops: do-while
loop, for loop.
- Feb. 2: Arrays; for-each loops
- Feb. 3rd. Example of a
class.
- Feb. 7: Implementation of a
stack of characters
- Feb. 11: Beginnning of
implementation of linked lists
- Feb. 14: A completed
implementation of linked lists
- Feb. 16: What will be printed by
this program?
- Feb. 18: Priority Queue
implementation using a linked list
- Feb. 21: Static variables, Review for the midterm
- Feb. 25: A
really nice web page on priority heaps, includes animation (scroll
down to see).
Implementation of a priority
queue using a heap.
- March 2: String
API, StringBuffer
API. Example of using String and StringBuffer: StringTest.java.
- March 4th, 7th: Binary Tree
Implementation (added a recursive inOrder() method on March 9).
Another
implementation of a binary search tree..
- March 21: Deleting a node from
a binary search tree
- March 23: Inheritance
- March 28: Typecasting
- March 30: Exercise on
inheritance;
Generic methods
- April 1:
Generic quicksort
Example of Java 5.0
generic types: a different way of writing generic methods. For more on
generic types see Tutorial
on generic types at java.sun.com.
- April 6: AVL tree implementation
- April 7: Exceptions added to a
linked list, Writing your own
exceptions
- April 14: Two-dimensional arrays.
- April 18: Hash tables.
- April 20: File Input/Output
examples, related APIs: BufferedReader,
PrintWriter.
Writing a graph implementation: Starting point for a graph
implementation.
- April 27. Second iteration of
graph implementation (adjacency lists).
Applets: A simple example;
a graphics example, its source code.
- April 29: Finished graph
implementation (adjacency lists). We will add breadth-first and
depth-first traversals to this implementation.
- May 1: Finished adjacency list
implementation with breadth-first and depth-first search methods
- May 4: A very simple swing
program, a swing program with
events.
APIs and tutorials: JPanel
API, Swing
components, Tutorial
on event listeners
- May 6: Some review problems