did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780201549911

Data Structures and Problem Solving Using Java

by
  • ISBN13:

    9780201549911

  • ISBN10:

    0201549913

  • Format: Hardcover
  • Copyright: 1997-10-01
  • Publisher: Pearson College Div
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $81.00

Summary

"The book's unique approach of separating the interface (how to use a data structure) and the implementation (how to program a structure) of each data structure into parts has been hailed by both professors and students as an outstanding and efficient way of teaching data structures. Professor Mark Allen Weiss continues with this approach in the third edition of Data Structures and Problem Solving Using Java by introducing concepts in four parts. Part 1 (tour of Java), Part 2 (Algorithms and Building Blocks), and Part 3 (Applications) lay the groundwork by discussing basic concepts and tools and providing some practical examples. Implementation of data structures is not shown until Part 4 (Implementations). This practical approach forces the student to think abstractly about the functionality of the data structures before implementing them." "This edition incorporates the many enhancements of Java 5.0. It includes coverage of generic programming and of the design of generic collection classes. The book is appropriate for students who are familiar with basic Java programming concepts or are new to the language and want to learn how it treats data structures concepts."--BOOK JACKET.

Table of Contents

Part I: Tour of Java 3(104)
CHAPTER 1 Primitive Java
3(24)
1.1 The General Environment
4(1)
1.2 The First Program
5(1)
1.2.1 Comments
5(1)
1.2.2 main
6(1)
1.2.3 Terminal Output
6(1)
1.3 Primitive Types
6(2)
1.3.1 The Primitive Types
6(1)
1.3.2 Constants
7(1)
1.3.3 Declaration and Initialization of Primitive Types
7(1)
1.3.4 Terminal Input and Output
8(1)
1.4 Basic Operators
8(3)
1.4.1 Assignment Operators
9(1)
1.4.2 Binary Arithmetic Operators
10(1)
1.4.3 Unary Operators
10(1)
1.4.4 Type Conversions
10(1)
1.5 Conditional Statements
11(7)
1.5.1 Relational and Equality Operators
11(1)
1.5.2 Logical Operators
12(1)
1.5.3 The if Statement
13(1)
1.5.4 The while Statement
14(1)
1.5.5 The for Statement
14(1)
1.5.6 The do Statement
15(1)
1.5.7 break and continue
16(1)
1.5.8 The switch Statement
17(1)
1.5.9 The Conditional Operator
17(1)
1.6 Methods
18(2)
1.6.1 Overloading of Method Names
19(1)
1.6.2 Storage Classes
20(1)
Summary
20(1)
Objects of the Game
20(2)
Common Errors
22(1)
On the Internet
23(1)
Exercises
23(2)
References
25(2)
CHAPTER 2 References
27(26)
2.1 What Is a Reference?
27(2)
2.2 Basics of Objects and References
29(4)
2.2.1 The Dot Operator (.)
30(1)
2.2.2 Declaration of Objects
30(1)
2.2.3 Garbage Collection
31(1)
2.2.4 The Meaning of =
31(1)
2.2.5 Parameter Passing
32(1)
2.2.6 The Meaning of ==
33(1)
2.2.7 Operator Overloading for Objects
33(1)
2.3 Strings
33(3)
2.3.1 Basics of String Manipulation
34(1)
2.3.2 String Concatenation
34(1)
2.3.3 Comparing Strings
35(1)
2.3.4 Other String Methods
35(1)
2.3.5 Converting between Strings and Primitive Types
35(1)
2.4 Arrays
36(6)
2.4.1 Declaration, Assignment, and Methods
36(3)
2.4.2 Dynamic Array Expansion
39(2)
2.4.3 Multidimensional Arrays
41(1)
2.4.4 Command-line Arguments
41(1)
2.5 Exception Handling
42(3)
2.5.1 Processing Exceptions
42(1)
2.5.2 The finally Clause
43(1)
2.5.3 Common Exceptions
43(1)
2.5.4 The throw and throws Clauses
44(1)
2.6 Input and Output
45(4)
2.6.1 Basic Stream Operations
46(1)
2.6.2 The StringTokenizer Object
46(1)
2.6.3 Sequential Files
47(2)
Summary
49(1)
Objects of the Game
49(2)
Common Errors
51(1)
On the Internet
51(1)
Exercises
51(1)
References
52(1)
CHAPTER 3 Objects and Classes
53(22)
3.1 What Is Object-oriented Programming?
53(2)
3.2 A Simple Example
55(2)
3.3 Javadoc
57(1)
3.4 Basic Methods
58(4)
3.4.1 Constructors
58(2)
3.4.2 Mutators and Accessors
60(1)
3.4.3 Output and toString
60(2)
3.4.4 equals
62(1)
3.4.5 static Methods
62(1)
3.4.6 main
62(1)
3.5 Packages
62(4)
3.5.1 The import Directive
63(1)
3.5.2 The package Statement
64(1)
3.5.3 The CLASSPATH Environment Variable
65(1)
3.5.4 Package-friendly Visibility Rules
66(1)
3.5.5 Separate Compilation
66(1)
3.6 Additional Constructs
66(4)
3.6.1 The this Reference
66(1)
3.6.2 The this Shorthand for Constructors
67(1)
3.6.3 The instanceof Operator
68(1)
3.6.4 Static Fields
68(1)
3.6.5 Static Initializers
69(1)
Summary
70(1)
Objects of the Game
70(1)
Common Errors
71(1)
On the Internet
72(1)
Exercises
72(2)
References
74(1)
CHAPTER 4 Inheritance
75(32)
4.1 What Is Inheritance
75(3)
4.2 Basic Java Syntax
78(6)
4.2.1 Visibility Rules
79(1)
4.2.2 The Constructor and super
79(1)
4.2.3 final Methods and Classes
80(1)
4.2.4 Overriding a Method
81(1)
4.2.5 Abstract Methods and Classes
82(2)
4.3 Example: Expanding the Shape Class
84(6)
4.3.1 Digression: An Introduction to Sorting
86(4)
4.4 Multiple Inheritance
90(1)
4.5 The Interface
90(4)
4.5.1 Specifying an Interface
91(1)
4.5.2 Implementing an Interface
91(3)
4.5.3 Multiple Interfaces
94(1)
4.6 Implementing Generic Components
94(3)
Summary
97(1)
Objects of the Game
98(1)
Common Errors
99(1)
On the Internet
100(1)
Exercises
100(2)
References
102(5)
Part II: Algorithms and Building Blocks 107(176)
CHAPTER 5 Algorithm Analysis
107(36)
5.1 What Is Algorithm Analysis?
107(4)
5.2 Examples of Algorithm Running Times
111(2)
5.3 The Maximum Contiguous Subsequence Sum Problem
113(8)
5.3.1 The Obvious O(N(3)) Algorithm
114(3)
5.3.2 An Improved O(N(2)) Algorithm
117(1)
5.3.3 A Linear Algorithm
118(3)
5.4 General Big-Oh Rules
121(3)
5.5 The Logarithm
124(3)
5.6 Static Searching Problem
127(4)
5.6.1 Sequential Search
127(1)
5.6.2 Binary Search
128(1)
5.6.3 Interpolation Search
129(2)
5.7 Checking an Algorithm Analysis
131(2)
5.8 Limitations of Big-Oh Analysis
133(1)
Summary
133(1)
Objects of the Game
134(1)
Common Errors
134(1)
On the Internet
135(1)
Exercises
135(4)
References
139(4)
CHAPTER 6 Data Structures
143(30)
6.1 Why Do We Need Data Structures?
143(2)
6.2 Stacks
145(3)
6.2.1 Stacks and Computer Languages
147(1)
6.3 Queues
148(2)
6.4 Linked Lists
150(5)
6.5 General Trees
155(2)
6.6 Binary Search Trees
157(4)
6.7 Hash Tables
161(2)
6.8 Priority Queues
163(3)
Summary
166(1)
Objects of the Game
167(1)
Common Errors
168(1)
On the Internet
168(1)
Exercises
169(3)
References
172(1)
CHAPTER 7 Recursion
173(50)
7.1 What Is Recursion?
173(1)
7.2 Background: Proofs by Mathematical Induction
174(3)
7.3 Basic Recursion
177(12)
7.3.1 Printing Numbers in Any Base
179(1)
7.3.2 Why It Works
180(2)
7.3.3 How It Works
182(1)
7.3.4 Too Much Recursion Can Be Dangerous
183(2)
7.3.5 Additional Examples
185(4)
7.4 Numerical Applications
189(8)
7.4.1 Modular Arithmetic
190(1)
7.4.2 Modular Exponentiation
190(2)
7.4.3 Greatest Common Divisor and Multiplicative Inverses
192(2)
7.4.4 The RSA Cryptosystem
194(3)
7.5 Divide-and-Conquer Algorithms
197(10)
7.5.1 The Maximum Contiguous Subsequence Sum Problem
197(2)
7.5.2 Analysis of a Basic Divide-and-Conquer Recurrence
199(5)
7.5.3 A General Upper Bound for Divide-and-Conquer Running Times
204(3)
7.6 Dynamic Programming
207(4)
7.7 Backtracking Algorithms
211(3)
Summary
214(1)
Objects of the Game
215(2)
Common Errors
217(1)
On the Internet
217(1)
Exercises
218(3)
References
221(2)
CHAPTER 8 Sorting Algorithms
223(36)
8.1 Why Is Sorting Important?
223(2)
8.2 Preliminaries
225(1)
8.3 Analysis of the Insertion Sort and Other Simple Sorts
225(2)
8.4 Shellsort
227(4)
8.4.1 Performance of Shellsort
229(2)
8.5 Mergesort
231(4)
8.5.1 Linear-time Merging of Sorted Arrays
231(3)
8.5.2 The Mergesort Algorithm
234(1)
8.6 Quicksort
235(13)
8.6.1 The Quicksort Algorithm
235(1)
8.6.2 Analysis of Quicksort
236(4)
8.6.3 Picking the Pivot
240(1)
8.6.4 A Partitioning Strategy
241(3)
8.6.5 Keys Equal to the Pivot
244(1)
8.6.6 Median-of-three Partitioning
244(1)
8.6.7 Small Arrays
245(1)
8.6.8 Java Quicksort Routine
246(2)
8.7 Quickselect
248(2)
8.8 A Lower Bound for Sorting
250(1)
Summary
251(1)
Objects of the Game
251(1)
Common Errors
252(1)
On the Internet
252(1)
Exercises
253(3)
References
256(3)
CHAPTER 9 Randomization
259(24)
9.1 Why Do We Need Random Numbers?
259(1)
9.2 Random-number Generators
260(5)
9.3 Nonuniform Random Numbers
265(3)
9.4 Generating a Random Permutation
268(1)
9.5 Randomized Algorithms
269(2)
9.6 Randomized Primality Testing
271(4)
Summary
275(1)
Objects of the Game
275(1)
Common Errors
276(1)
On the Internet
277(1)
Exercises
277(2)
References
279(4)
Part III: Applications 283(128)
CHAPTER 10 Fun and Games
283(20)
10.1 Word Search Puzzles
283(9)
10.1.1 Theory
283(5)
10.1.2 Java Implementation
288(4)
10.2 The Game of Tic-Tac-Toe
292(7)
10.2.1 Alpha-beta Pruning
292(1)
10.2.2 Transposition Tables
293(5)
10.2.3 Computer Chess
298(1)
Summary
299(1)
Objects of the Game
299(1)
Common Errors
300(1)
On the Internet
300(1)
Exercises
300(2)
References
302(1)
CHAPTER 11 Stacks and Compilers
303(28)
11.1 Balanced-symbol Checker
303(10)
11.1.1 Basic Algorithm
303(3)
11.1.2 Implementation
306(7)
11.2 A Simple Calculator
313(14)
11.2.1 Postfix Machines
314(2)
11.2.2 Infix to Postfix Conversion
316(2)
11.2.3 Implementation
318(8)
11.2.4 Expression Trees
326(1)
Summary
327(1)
Objects of the Game
327(1)
Common Errors
328(1)
On the Internet
328(1)
Exercises
329(1)
References
330(1)
CHAPTER 12 Utilities
331(18)
12.1 File Compression
331(7)
12.1.1 Prefix Codes
332(2)
12.1.2 Huffman's Algorithm
334(3)
12.1.3 The Encoding Phase
337(1)
12.1.4 Decoding Phase
337(1)
12.1.5 Practical Considerations
338(1)
12.2 A Cross-reference Generator
338(5)
12.2.1 Basic Ideas
339(1)
12.2.2 Java Implementation
339(4)
Summary
343(2)
Objects of the Game
345(1)
Common Errors
345(1)
On the Internet
345(1)
Exercises
345(3)
References
348(1)
CHAPTER 13 Simulation
349(18)
13.1 The Josephus Problem
349(5)
13.1.1 The Simple Solution
350(2)
13.1.2 A More Efficient Algorithm
352(2)
13.2 Event-driven Simulation
354(9)
13.2.1 Basic Ideas
354(2)
13.2.2 Example: A Modem Bank Simulation
356(7)
Summary
363(1)
Objects of the Game
363(1)
Common Errors
364(1)
On the Internet
364(1)
Exercises
364(3)
CHAPTER 14 Graphs and Paths
367(44)
14.1 Definitions
367(12)
14.1.1 Representation
369(10)
14.2 Unweighted Shortest-path Problem
379(8)
14.2.1 Theory
382(4)
14.2.2 Java Implementation
386(1)
14.3 Positive-weighted, Shortest-path Problem
387(6)
14.3.1 Theory: Dijkstra's Algorithm
387(3)
14.3.2 Java Implementation
390(3)
14.4 Negative-weighted, Shortest-path Problem
393(2)
14.4.1 Theory
393(2)
14.4.2 Java Implementation
395(1)
14.5 Path Problems in Acyclic Graphs
395(8)
14.5.1 Topological Sorting
396(2)
14.5.2 Theory of the Acyclic Shortest-path Algorithm
398(1)
14.5.3 Java Implementation
399(1)
14.5.4 An Application: Critical-path Analysis
399(4)
Summary
403(1)
Objects of the Game
403(2)
Common Errors
405(1)
On the Internet
405(1)
Exercises
405(3)
References
408(3)
Part IV: Implementations 411(206)
CHAPTER 15 Stacks and Queues
411(22)
15.1 Dynamic Array Implementations
411(10)
15.1.1 Stacks
411(5)
15.1.2 Queues
416(5)
15.2 Linked-list Implementations
421(7)
15.2.1 Stacks
422(4)
15.2.2 Queues
426(2)
15.3 Comparison of the Two Methods
428(1)
15.4 Double-ended Queues
428(1)
Summary
429(1)
Objects of the Game
430(1)
Common Errors
430(1)
On the Internet
430(1)
Exercises
430(3)
CHAPTER 16 Linked Lists
433(22)
16.1 Basic Ideas
433(4)
16.1.1 Header Nodes
435(1)
16.1.2 Iterator Classes
436(1)
16.2 Java Implementation
437(8)
16.3 Doubly Linked Lists and Circular Linked Lists
445(2)
16.4 Sorted Linked Lists
447(3)
Summary
450(1)
Objects of the Game
450(1)
Common Errors
450(1)
On the Internet
451(1)
Exercises
451(4)
CHAPTER 17 Trees
455(34)
17.1 General Trees
455(8)
17.1.1 Definitions
455(2)
17.1.2 Implementation
457(2)
17.1.3 An Application: File Systems
459(4)
17.2 Binary Trees
463(5)
17.3 Recursion and Trees
468(3)
17.4 Tree Traversal: Iterator Classes
471(12)
17.4.1 Postorder Traversal
474(3)
17.4.2 Inorder Traversal
477(1)
17.4.3 Preorder Traversal
477(4)
17.4.4 Level-order Traversals
481(2)
Summary
483(1)
Objects of the Game
483(1)
Common Errors
484(1)
On the Internet
484(1)
Exercises
485(4)
CHAPTER 18 Binary Search Trees
489(64)
18.1 Basic Ideas
489(11)
18.1.1 The Operations
490(4)
18.1.2 Java Implementation
494(6)
18.2 Order Statistics
500(4)
18.2.1 Java Implementation
500(4)
18.3 Analysis of Binary Search Tree Operations
504(4)
18.4 AVL Trees
508(9)
18.4.1 Properties
509(2)
18.4.2 Single Rotation
511(1)
18.4.3 Double Rotation
512(3)
18.4.4 Summary of AVL Insertion
515(2)
18.5 Red-Black Trees
517(13)
18.5.1 Bottom-up Insertion
518(2)
18.5.2 Top-down Red-Black Trees
520(2)
18.5.3 Java Implementation
522(4)
18.5.4 Top-down Deletion
526(4)
18.6 AA-Trees
530(10)
18.6.1 Insertion
532(4)
18.6.2 Deletion
536(1)
18.6.3 Java Implementation
537(3)
18.7 B-Trees
540(5)
Summary
545(1)
Objects of the Game
546(1)
Common Errors
547(1)
On the Internet
547(1)
Exercises
548(2)
References
550(3)
CHAPTER 19 Hash Tables
553(28)
19.1 Basic Ideas
553(1)
19.2 Hash Function
554(3)
19.3 Linear Probing
557(5)
19.3.1 Naive Analysis of Linear Probing
558(2)
19.3.2 What Really Happens: Primary Clustering
560(1)
19.3.3 Analysis of the find Operation
560(2)
19.4 Quadratic Probing
562(11)
19.4.1 Java Implementation
568(4)
19.4.2 Analysis of Quadratic Probing
572(1)
19.5 Separate Chaining Hashing
573(1)
Summary
573(2)
Objects of the Game
575(1)
Common Errors
575(1)
On the Internet
576(1)
Exercises
576(1)
References
578(3)
CHAPTER 20 A Priority Queue: The Binary Heap
581(36)
20.1 Basic Ideas
581(7)
20.1.1 Structure Property
582(2)
20.1.2 Heap-order Property
584(1)
20.1.3 Allowed Operations
584(4)
20.2 Implementation of the Basic Operations
588(5)
20.2.1 insert
588(3)
20.2.2 deleteMin
591(2)
20.3 fixHeap: Linear Time Heap Construction
593(5)
20.4 Advanced Operations: decreaseKey and merge
598(1)
20.5 Internal Sorting: Heapsort
598(3)
20.6 External Sorting
601(7)
20.6.1 Why We Need New Algorithms
601(1)
20.6.2 Model for External Sorting
602(1)
20.6.3 The Simple Algorithm
602(2)
20.6.4 Multiway Merge
604(1)
20.6.5 Polyphase Merge
604(3)
20.6.6 Replacement Selection
607(1)
Summary
608(1)
Objects of the Game
608(1)
Common Errors
609(1)
On the Internet
610(1)
Exercises
610(2)
References
612(5)
Part V: Advanced Data Structures 617(80)
CHAPTER 21 Splay Trees
617(26)
21.1 Self-adjustment and Amortized Analysis
617(4)
21.1.1 Amortized Time Bounds
618(1)
21.1.2 A Simple Self-adjusting Strategy (That Does Not Work)
619(2)
21.2 The Basic Bottom-up Splay Tree
621(2)
21.3 Basic Splay Tree Operations
623(1)
21.4 Analysis of Bottom-up Splaying
624(6)
21.4.1 Proof of the Splaying Bound
627(3)
21.5 Top-down Splay Trees
630(3)
21.6 Implementation of Top-down Splay Trees
633(3)
21.7 Comparison of the Splay Tree with Other Search Trees
636(4)
Summary
640(1)
Objects of the Game
640(1)
Common Errors
640(1)
On the Internet
641(1)
Exercises
641(1)
References
642(1)
CHAPTER 22 Merging Priority Queues
643(22)
22.1 The Skew Heap
643(5)
22.1.1 Merging Is Fundamental
643(1)
22.1.2 Simplistic Merging of Heap-ordered Trees
644(1)
22.1.3 The Skew Heap: A Simple Modification
645(1)
22.1.4 Analysis of the Skew Heap
646(2)
22.2 The Pairing Heap
648(12)
22.2.1 Pairing Heap Operations and Theory
649(2)
22.2.2 Implementation of the Pairing Heap
651(9)
22.2.3 Application: Dijkstra's Shortest Weighted Path Algorithm
660(1)
Summary
660(1)
Objects of the Game
661(1)
Common Errors
661(1)
On the Internet
661(1)
Exercises
661(1)
References
662(3)
CHAPTER 23 The Disjoint Set Class
665(32)
23.1 Equivalence Relations
665(1)
23.2 Dynamic Equivalence and Two Applications
666(6)
23.2.1 Application #1: Minimum Spanning Trees
667(2)
23.2.2 Application #2: The Nearest Common Ancestor Problem
669(3)
23.3 The Quick-find Algorithm
672(2)
23.4 The Quick-union Algorithm
674(5)
23.4.1 Smart Union Algorithms
676(1)
23.4.2 Path Compression
677(2)
23.5 Java Implementation
679(2)
23.6 Worst Case for Union-by-rank and Path Compression
681(8)
23.6.1 Analysis of the Union Find Algorithm
682(7)
Summary
689(1)
Objects of the Game
689(1)
Common Error
690(1)
On the Internet
690(1)
Exercises
690(2)
References
692(5)
APPENDICES 697(72)
APPENDIX A Java Platforms
697(16)
A.1 Setting the Environment
697(3)
A.1.1 Unix Instructions
698(1)
A.1.2 Windows 95 NT Instructions
699(1)
A.2 Sun's JDK
700(1)
A.3 Visual Development Environments
700(13)
A.3.1 Symantec Cafe
701(6)
A.3.2 Microsoft Visual J++
707(6)
APPENDIX B Operators
713(2)
APPENDIX C Some Library Routines
715(16)
C.1 Classes in Package java.lang
715(9)
C.1.1 Character
715(1)
C.1.2 Integer
716(1)
C.1.3 Object
717(1)
C.1.4 String
718(1)
C.1.5 StringBuffer
719(2)
C.1.6 System
721(2)
C.1.7 Thread
723(1)
C.1.8 Throwable
723(1)
C.2 Classes in Package java.io
724(3)
C.2.1 BufferedReader
724(1)
C.2.2 File
725(1)
C.2.3 FileReader
726(1)
C.2.4 InputStreamReader
726(1)
C.2.5 PushbackReader
727(1)
C.3 Classes in Package java.util
727(3)
C.3.1 Random
728(1)
C.3.2 StringTokenizer
728(2)
C.3.3 Vector
730(1)
On the Internet
730(1)
APPENDIX D Graphical User Interfaces
731(38)
D.1 The Abstract Window Toolkit
731(1)
D.2 Basic Objects in the AWT
732(9)
D.2.1 Component
733(1)
D.2.2 Container
734(1)
D.2.3 Top-level Windows
734(2)
D.2.4 Panel
736(1)
D.2.5 Important I O Components
736(5)
D.3 Basic AWT Principles
741(9)
D.3.1 Layout Managers
741(4)
D.3.2 Graphics
745(2)
D.3.3 Events
747(3)
D.3.4 Summary: Putting the Pieces Together
750(1)
D.4 Animations and Threads
750(3)
D.5 Applets
753(9)
D.5.1 Hypertext Markup Language
753(3)
D.5.2 Parameters
756(1)
D.5.3 Applet Limitations
756(2)
D.5.4 Making an Application an Applet
758(2)
D.5.5 Applets with Animation
760(2)
Summary
762(1)
Objects of the Game
762(2)
Common Errors
764(1)
On the Internet
765(1)
Exercises
766(2)
Reference
768(1)
Index 769

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program