Source Code for Data Structures and Problem Solving Using Java, Fourth Edition

LAST UPDATE: September 1, 2009

Here is the source code for Data Structures and Problem Solving Using Java (Fourth Edition), by Mark Allen Weiss. The materials here are copyrighted. I have successfully compiled and tested the programs with JDK 1.6.0 update 11.

Organization of Files

  1. Most of the general, standalone, code is in the root directory.
  2. There is an implementation of a large subset of java.util in package weiss.util. Its purpose is to illustrate how the concepts are used in an actual library implementation. This can be found in the weiss\util folder. Some of the sample code imports classes in weiss.util, but you can freely replace all occurrences of weiss.util with java.util. Needless to say, everything in weiss.util has a name clash with java.util, so you should not use wild-card import directives. These files are displayed in BOLDFACE font.
  3. The package weiss.nonstandard, in the weiss\nonstandard folder, contains nonstandard implementations of various data structures. The code is generally simpler that the code in the Java Collections API, and there are occasional name clashes (e.g. LinkedList and Stack). This package also contains priority queue implementations, since that is not part of the Java Collections API. These files are display in ITALICS font.

Complete Bundle

Package Documentation


Chapter 1: Basic Java

Chapter 2: References

Chapter 3: Classes

Chapter 4: Inheritance

Chapter 5: Running Times

Chapter 6: The Collections API, extends java.util.Iterator

Chapter 7: Recursion

Chapter 8: Sorting

Chapter 9: Randomization

Chapter 10: Fun and Games puz.txt

Chapter 11: Applications of Stacks -- Compilers and Parsing

Chapter 12: Utilities

Chapter 13: Simulation

Chapter 14: Shortest Path Algorithms graph1.txt graph2.txt graph3.txt

Chapter 15: Inner Classes and ArrayList Implementation

Chapter 16: Stacks

Chapter 17: Linked Lists

Chapter 18: Trees

Chapter 19: Search Trees

Chapter 20: Hash Tables

Chapter 21: Heaps

Chapter 22: Splay Trees

Chapter 23: Pairing Heaps

Chapter 24: Disjoint Sets

Appendix B: Swing