Source Code for Data Structures and Algorithm Analysis in Java

Here is the source code for Data Structures and Algorithm Analysis in Java, by Mark Allen Weiss. The materials here are copyrighted.

These files go in the Miscellaneous subdirectory.

Here is each file.

Fig01_02.java: A simple recursive routine with a test program

Fig01_03.java: An example of infinite recursion

Fig01_04.java: Recursive routine to print numbers, with a test program

IntCell.java: IntCell -- A class for simulating an integer memory cell

TestIntCell.java: Exercise IntCell

MemoryCell.java: MemoryCell -- A class for simulating an generic memory cell

TestMemoryCell.java: Exercise MemoryCell

DivideByTwo.java: Program to illustrate exceptions

MaxTest.java: Demonstrate the string tokenizer

ListFiles.java: Program to list contents of a file

NumberLines.java: Program to file copy

MaxSumTest.java: Various maximum subsequence sum algorithms

Fig02_09.java: Test program for binary search

Fig02_10.java: Euclid's algorithm, with a test program

Fig02_11.java: Recursive exponentiation algorithm, with a test program

Polynomial.java: Polynomials

FileSystem.java: Implementation of file system traversal

Fig10_38.java: Simple matrix multiplication algorithm with a test program

Fig10_40.java: Algorithms to compute Fibonacci numbers

Fig10_43.java: Inefficient recursive algorithm (see text)

Fig10_45.java: Better algorithm to replace fig10_43.java (see text)

Fig10_46.java: Dynamic programming algorithm for optimal chain matrix multiplication, with a test program

Fig10_53.java: All-pairs algorithm, with a test program

Fig10_62.java: Randomized primality testing algorithm, with a test program

KdTree.java: Implementation and test program for k-d trees

ComparatorTest.java: Sorting strings by length using Collections API

Concordance.java: Concordance program using Collections API

Concordance2.java: Concordance program not using Collections API

Graph.java: Shortest path program using Collections API

Graph2.java: Shortest path program not using Collections API