Data Structures and Algorithms in Java / Edition 2

Hardcover (Print)
Rent from
(Save 75%)
Est. Return Date: 07/27/2015
Used and New from Other Sellers
Used and New from Other Sellers
from $24.46
Usually ships in 1-2 business days
(Save 62%)
Other sellers (Hardcover)
  • All (20) from $24.46   
  • New (10) from $35.87   
  • Used (10) from $24.32   


Data Structures and Algorithms in Java, Second Edition is designed to be easy to read and understand although the topic itself is complicated. Algorithms are the procedures that software programs use to manipulate data structures. Besides clear and simple example programs, the author includes a workshop as a small demonstration program executable on a Web browser. The programs demonstrate in graphical form what data structures look like and how they operate. In the second edition, the program is rewritten to improve operation and clarify the algorithms, the example programs are revised to work with the latest version of the Java JDK, and questions and exercises will be added at the end of each chapter making the book even more useful.

Educational Supplement

Suggested solutions to the programming projects found at the end of each chapter are made available to instructors at recognized educational institutions. This educational supplement can be found at, in the Instructor Resource Center.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
“No pain, no gain” does not have to apply to data structures and algorithms. In the long-awaited Second Edition of Data Structures & Algorithms in Java, Robert Lafore proves once again that you can learn this stuff in English -- without compromising your ability to make the most of it.

Lafore brings a strong practical focus to arrays, sorts, stacks, queues, linked lists, recursion, trees, hash tables, heaps, graphs, and other essential topics. He shows how every technique works, when to use it, and how it looks in real Java code. (Of which there’s plenty -- including “Workshop applets” on the Web that go even further toward illuminating his explanations.)

Much of the code, first published in 1998, has been revamped to reflect Sun’s latest releases -- and five years' more experience with Java. Plenty of new topics are covered, too: depth-first-search and game simulations; Huffman codes for data compression; the classic “Traveling Salesman” problem and “Knight’s Tour” puzzle; Floyd’s and Warshall’s algorithms; 2-3 trees; radix sorts, and more. Finally, new programming projects and end-of-chapter questions make this book a complete hands-on course.

Lafore’s focus is on making sure you walk away with a strong understanding of how data structures and algorithms really work. So he only briefly alludes to Java’s built-in data structure classes (Vector, Stack, Hashtable, et al.). That’s about all that’s missing, though. And you’ll have the consolation of knowing that you understand data structures and algorithms well enough to use them anywhere -- in Java or whatever language comes next. Bill Camarda

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780672324536
  • Publisher: Sams
  • Publication date: 11/6/2002
  • Edition description: Subsequent
  • Edition number: 2
  • Pages: 800
  • Sales rank: 344,694
  • Product dimensions: 7.50 (w) x 9.30 (h) x 1.90 (d)

Meet 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 and Object-Oriented Programming in C++. Earlier best-selling titles include Assembly Language Primer for the IBM PC and XT and (back at the beginning of the computer revolution) Soul of CP/M.

Read More Show Less

Table of Contents


What's New in the Second Edition. What This Book Is About. What's Different About This Book. Who This Book Is For. What You Need to Know Before You Read This Book. The Software You Need to Use This Book. How This Book Is Organized. Enjoy Yourself!

1. Overview.

What Are Data Structures and Algorithms Good For? Overview of Data Structures. Overview of Algorithms. Some Definitions. Object-Oriented Programming. Software Engineering. Java for C++ Programmers. Java Library Data Structures. Summary. Questions.

2. Arrays.

The Array Workshop Applet. The Basics of Arrays in Java. Dividing a Program into Classes. Class Interfaces. The Ordered Workshop Applet. Java Code for an Ordered Array. Logarithms. Storing Objects. Big O Notation. Whay Not Use Arrays for Everything. Summary. Questions. Experiments. Programming Projects.

3. Simple Sorting.

How Would You Do It. Bubble Sort. Selection Sort. Insertion Sort. Sorting Objects. Comparing the Simple Sorts. Summary. Questions. Experiments. Programming Projects.

4. Stacks and Queues.

A Different Kind of Structure. Stacks. Queues. Priority Queues. Parsing Arithmetic Expressions. Summary. Questions. Experiments. Programming Projects.

5. Linked Lists.

Links. The LinkList Workshop Applet. A Simple Linked List. Finding and Deleting Specified Links. Double-Ended Lists. Linked-List Efficiency. Abstract Data Types. Sorted Lists. Doubly Linked Lists. Iterators. Summary. Questions. Experiments. Programming Projects.

6. Recursion.

Triangular Numbers. Factorials. Anagrams. A Recursive Binary Search. The Towers of Hanoi. Mergesort. Eliminating Recursion. Some Interesting Recursive Applications. Summary. Questions. Experiments. Programming Projects.

7. Advanced Sorting.

Shellsort. Paartitioning. Quicksort. Radix Sort. Summary. Questions. Experiments. Programming Projects.

8. Binary Trees.

Why Use Binary Trees? Tree Terminology. An Analogy. How Do Binary Search Trees Work. Finding a Node. Inserting a Node. Traversing the Tree. Finding Maximum and Minimum Values. Deleting a Node. The Efficiency of Binary Trees. Trees Represented as Arrays. Duplicate Keys. The Complete Program. The Huffman Code. Summary. Questions. Experiments. Programming Projects.

9. Red-Black Trees.

Our Approach to the Discussion. Balanced and Unbalanced Trees. Using the RBTree Workshop Applet. Experimenting with the Workshop Applet. Rotations. Inserting a New Node. Deletion. The Efficiency of Red-Black Trees. Red-Black Tree Implementation. Other Balanced Trees. Summary. Questions. Experiments.

10. 2-3-4 Trees and External Storage.

Introduction to 2-3-4 Trees. The Tree234 Workshop Applet. Java Code for a 2-3-4 Tree. 2-3-4 Trees and Red-Black Trees. Efficiency of 2-3-4 Trees. 2-3 Trees. External Storage. Summary. Questions. Experiments. Programming Projects.

11. Hash Tables.

Introduction to Hashing. Open Addressing. Separate Chaining. Hash Functions. Hashing Efficiency. Hashing and External Storage. Summary. Questions. Experiments. Programming Projects.

12. Heaps.

Introduction to Heaps. The Heap Workshop Applet. Java Code fo Heaps. A Tree-based Heap. Heapsort. Summary. Questions. Experiments. Programming Projects.

13. Graphs.

Introduction to Graphs. Searches. Minimum Spanning Trees. Topological Sorting with Directed Graphs. Connectivity in Directed Graphs. Summary. Questions. Experiments. Programming Projects.

14. Weighted Graphs.

Minimum Spanning Tree with Weighted Graphs. The Shortest-Path Problem. The All-Pairs Shortest-Path Problem. Efficiency. Intractable Problems. Summary. Questions. Experiments. Programming Projects.

15. When to Use What.

General-Purpose Data Structures. Special-Purpose Data Structures. Sorting. Graphs. External Storage. Onward.

Appendix A. Running the Workshop Applets and Example Programs.

The Workshop Applets. The Example Programs. The Sun Microsystem's Software Development Kit. Multiple Class Files. Other Development Systems.

Appendix B. Further Reading.

Data Structures and Algorithms. Object-Oriented Programming Languages. Object-Oriented Design (OOD) and Software Engineering.

Appendix C. Answers to Questions.

Chapter 1, Overview. Chapter 2, Arrays. Chapter 3, Simple Sorting. Chapter 4, Stacks and Queues. Chapter 5, Linked Lists. Chapter 6, Recursion. Chapter 7, Advanced Sorting. Chapter 8, Binary Trees. Chapter 9, Red-Black Trees. Chapter 10, 2-3-4 Trees and External Storage. Hash Tables. Heaps. Graphs. Weighted Graphs.


Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted May 14, 2003

    Very well made

    This book is a great treatment on data structures. The author is thorough and explains the material clearly. Anyone looking to learn data structures should take a look at this book.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)