data structures and algorithms in java ebook download
The article part：
• Data Structures and Algorithms in Java, by Robert Lafore (The Waite
Group, 1998) "A beautifully written and illustrated introduction to
manipulating data in practical ways, using Java examples."
• Designed to be the most easily understood book ever written on data
structures and algorithms
• Data Structures and Algorithms is taught with "Workshop Applets+ -
animated Java programs that introduce complex topics in an
intuitively obvious way
• The text is clear, straightforward, non-academic, and supported by
• Simple programming examples are written in Java, which is easier to
understand than C++
About the Author
Robert Lafore has degrees in Electrical Engineering and Mathematics, has
worked as a systems analyst for the Lawrence Berkeley Laboratory, founded
his own software company, and is a best-selling writer in the field of computer
programming. Some of his current titles are C++ Interactive Course, Object
This introduction tells you briefly
• What this book is about
• Why it's different
• Who might want to read it
• What you need to know before you read it
• The software and equipment you need to use it
• How this book is organized
What This Book Is About
This book is about data structures and algorithms as used in computer programming.
Data structures are ways in which data is arranged in your computer's memory (or stored
on disk). Algorithms are the procedures a software program uses to manipulate the data
in these structures.
Almost every computer program, even a simple one, uses data structures and algorithms.
For example, consider a program that prints address labels. The program might use an
array containing the addresses to be printed, and a simple for loop to step through the
array, printing each address.
The array in this example is a data structure, and the for loop, used for sequential
access to the array, executes a simple algorithm. For uncomplicated programs with small
amounts of data, such a simple approach might be all you need. However, for programs
that handle even moderately large amounts of data, or that solve problems that are
slightly out of the ordinary, more sophisticated techniques are necessary. Simply knowing
the syntax of a computer language such as Java or C++ isn't enough.
This book is about what you need to know after you've learned a programming language.
The material we cover here is typically taught in colleges and universities as a second-year
course in computer science, after a student has mastered the fundamentals of
W hat's Different About This Book
There are dozens of books on data structures and algorithms. What's different about this
one? Three things:
• Our primary goal in writing this book is to make the topics we cover easy to
Demonstration programs called Workshop applets bring to life the topics we cover,
showing you step by step, with "moving pictures," how data structures and algo
Chapter 4, "Stacks and Queues," covers three data structures that can be thought of as
Abstract Data Types (ADTs): the stack, queue, and priority queue. These structures
reappear later in the book, embedded in various algorithms. Each is demonstrated by a
Workshop applet. The concept of ADTs is discussed.
Chapter 5, "Linked Lists," introduces linked lists, including doubly linked lists and doubleended
lists. The use of references as "painless pointers" in Java is explained. A
Workshop applet shows how insertion, searching, and deletion are carried out.
In Chapter 6, "Recursion," we explore recursion, one of the few chapter topics that is not
a data structure. Many examples of recursion are given, including the Towers of Hanoi
puzzle and the mergesort, which are demonstrated by Workshop applets.
Chapter 7, "Advanced Sorting," delves into some advanced sorting techniques: Shellsort
and quicksort. Workshop applets demonstrate Shellsort, partitioning (the basis of
quicksort), and two flavors of quicksort.
In Chapter 8, "Binary Trees," we begin our exploration of trees. This chapter covers the
simplest popular tree structure: unbalanced binary search trees. A Workshop applet
demonstrates insertion, deletion, and traversal of such trees.
Chapter 9, "Red-Black Trees," explains red-black trees, one of the most efficient
balanced trees. The Workshop applet demonstrates the rotations and color switches
necessary to balance the tree.
In Chapter 10, "2-3-4 Trees and External Storage," we cover 2-3-4 trees as an example
of multiway trees. A Workshop applet shows how they work. We also discuss the
relationship of 2-3-4 trees to B-trees, which are useful in storing external (disk) files.
Chapter 11, "Hash Tables," moves into a new field, hash tables. Workshop applets
demonstrate several approaches: linear and quadratic probing, double hashing, and
separate chaining. The hash-table approach to organizing external files is discussed.
In Chapter 12, "Heaps," we discuss the heap, a specialized tree used as an efficient
implementation of a priority queue.
Chapters 13, "Graphs," and 14, "Weighted Graphs," deal with graphs, the first with
unweighted graphs and simple searching algorithms, and the second with weighted
graphs and more complex algorithms involving the minimum spanning trees and shortest
In Chapter 15, "When to Use What," we summarize the various data structures described
in earlier chapters, with special attention to which structure is appropriate in a given
Appendix A, "How to Run the Workshop Applets and Example Programs," tells how to
use the Java Development Kit (the JDK) from Sun Microsystems, which can be used to
run the Workshop applets and the example programs. The readme file on the included
CD-ROM has additional information on these topics.
Appendix B, "Further Reading," describes some books appropriate for further reading on
data structures and other related topics.
We hope we've made the learning process as painless as possible. Ideally, it should even
be fun. Let us know if you think we've succeeded in reaching this ideal, or if not
Thanks for visiting!