|
Object-Oriented Programming |
|
|
1 | (36) |
|
|
1 | (4) |
|
|
5 | (3) |
|
Implementing the Software Design |
|
|
8 | (3) |
|
|
11 | (3) |
|
Implementing and Testing an Algorithm |
|
|
14 | (2) |
|
The Unified Modeling Language |
|
|
16 | (2) |
|
Inheritance, Aggregation, and Composition |
|
|
18 | (4) |
|
Mutable and Immutable Objects |
|
|
22 | (15) |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
31 | (4) |
|
Answers to Review Questions |
|
|
35 | (2) |
|
|
37 | (36) |
|
|
37 | (1) |
|
|
38 | (2) |
|
|
40 | (3) |
|
Preconditions and Postconditions |
|
|
43 | (2) |
|
|
45 | (1) |
|
|
46 | (4) |
|
Implementing Preconditions and Postconditions |
|
|
50 | (4) |
|
Using the assert Statement |
|
|
54 | (3) |
|
|
57 | (1) |
|
Inheritance and Polymorphism |
|
|
58 | (15) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
62 | (5) |
|
|
67 | (1) |
|
|
67 | (3) |
|
Answers to Review Questions |
|
|
70 | (3) |
|
|
73 | (48) |
|
|
73 | (4) |
|
Printing an Array in Java |
|
|
77 | (1) |
|
Some Simple Array Algorithms |
|
|
77 | (2) |
|
|
79 | (1) |
|
|
80 | (1) |
|
|
81 | (3) |
|
|
84 | (2) |
|
The java.util.Arrays Class |
|
|
86 | (2) |
|
A User-Defined IntArrays Class |
|
|
88 | (2) |
|
The java.util.Vector Class |
|
|
90 | (4) |
|
|
94 | (4) |
|
Case Study: Building a Concordance |
|
|
98 | (23) |
|
|
110 | (1) |
|
|
111 | (1) |
|
|
111 | (3) |
|
|
114 | (5) |
|
|
119 | (1) |
|
Answers to Review Questions |
|
|
120 | (1) |
|
|
121 | (30) |
|
Maintaining an Ordered Array |
|
|
121 | (2) |
|
|
123 | (2) |
|
|
125 | (8) |
|
Inserting an Element into a Linked List |
|
|
133 | (3) |
|
Inserting at the Front of the List |
|
|
136 | (2) |
|
Deleting from a Sorted Linked List |
|
|
138 | (1) |
|
|
139 | (2) |
|
Case Study: Arbitrarily Long Integers |
|
|
141 | (10) |
|
|
146 | (1) |
|
|
146 | (1) |
|
|
147 | (1) |
|
|
147 | (2) |
|
|
149 | (1) |
|
Answers to Review Questions |
|
|
150 | (1) |
|
|
151 | (26) |
|
|
151 | (2) |
|
|
153 | (4) |
|
Application: Evaluating Postfix Expressions |
|
|
157 | (2) |
|
Case Study: Solving a Maze |
|
|
159 | (8) |
|
|
167 | (3) |
|
The java.util.Stack Class |
|
|
170 | (7) |
|
|
171 | (1) |
|
|
171 | (1) |
|
|
172 | (1) |
|
|
172 | (2) |
|
|
174 | (1) |
|
Answers to Review Questions |
|
|
175 | (2) |
|
|
177 | (22) |
|
|
177 | (2) |
|
Case Study: Capital Gains Valuation |
|
|
179 | (2) |
|
|
181 | (3) |
|
Case Study: Simulation with Queues |
|
|
184 | (15) |
|
|
195 | (1) |
|
|
195 | (1) |
|
|
195 | (1) |
|
|
196 | (1) |
|
|
197 | (1) |
|
Answers to Review Questions |
|
|
198 | (1) |
|
|
199 | (34) |
|
The Java Collections Framework |
|
|
199 | (1) |
|
A Simple Collection Interface |
|
|
200 | (1) |
|
|
201 | (2) |
|
An AbstractCollection Class |
|
|
203 | (3) |
|
|
206 | (5) |
|
|
211 | (4) |
|
The Complete java.util.Collection Interface |
|
|
215 | (3) |
|
The java.util.AbstractCollection Class |
|
|
218 | (15) |
|
|
221 | (1) |
|
|
222 | (1) |
|
|
223 | (4) |
|
|
227 | (2) |
|
|
229 | (2) |
|
Answers to Review Questions |
|
|
231 | (2) |
|
|
233 | (32) |
|
List Classes in the Java Collections Framework |
|
|
233 | (1) |
|
Bidirectional List Iterators |
|
|
234 | (6) |
|
The java.util.List Interface |
|
|
240 | (1) |
|
Implementing the java.util.List Interface |
|
|
241 | (8) |
|
Linked Lists of Primitives and Specialized Objects |
|
|
249 | (2) |
|
Case Study: Polynomial Algebra |
|
|
251 | (14) |
|
|
260 | (1) |
|
|
260 | (1) |
|
|
260 | (1) |
|
|
261 | (1) |
|
|
262 | (1) |
|
Answers to Review Questions |
|
|
263 | (2) |
|
|
265 | (32) |
|
|
265 | (3) |
|
|
268 | (2) |
|
|
270 | (3) |
|
|
273 | (2) |
|
|
275 | (3) |
|
Other Collision Resolution Algorithms |
|
|
278 | (3) |
|
|
281 | (3) |
|
The java.util.HashMap Class |
|
|
284 | (2) |
|
Analysis of Hashing Algorithms |
|
|
286 | (1) |
|
|
287 | (3) |
|
|
290 | (7) |
|
|
291 | (2) |
|
|
293 | (1) |
|
|
293 | (2) |
|
|
295 | (1) |
|
|
296 | (1) |
|
Answers to Review Questions |
|
|
296 | (1) |
|
|
297 | (32) |
|
|
297 | (3) |
|
|
300 | (3) |
|
|
303 | (3) |
|
|
306 | (3) |
|
Storing Instead of Recomputing |
|
|
309 | (2) |
|
|
311 | (2) |
|
The Recursive Binary Search Algorithm |
|
|
313 | (2) |
|
|
315 | (1) |
|
|
315 | (3) |
|
|
318 | (11) |
|
|
321 | (1) |
|
|
322 | (1) |
|
|
322 | (1) |
|
|
323 | (3) |
|
|
326 | (2) |
|
Answers to Review Questions |
|
|
328 | (1) |
|
|
329 | (24) |
|
|
329 | (1) |
|
|
330 | (6) |
|
The Recursive Definition of a Tree |
|
|
336 | (3) |
|
Application: Decision Trees |
|
|
339 | (2) |
|
|
341 | (1) |
|
Traversal Algorithms for Ordered Trees |
|
|
342 | (2) |
|
|
344 | (9) |
|
|
346 | (1) |
|
|
347 | (1) |
|
|
347 | (3) |
|
|
350 | (1) |
|
|
350 | (1) |
|
Answers to Review Questions |
|
|
351 | (2) |
|
|
353 | (22) |
|
|
353 | (1) |
|
Properties of Binary Trees |
|
|
354 | (1) |
|
|
355 | (2) |
|
Binary Tree Traversal Algorithms |
|
|
357 | (1) |
|
|
358 | (4) |
|
|
362 | (2) |
|
|
364 | (11) |
|
|
365 | (1) |
|
|
366 | (1) |
|
|
367 | (2) |
|
|
369 | (4) |
|
|
373 | (1) |
|
Answers to Review Questions |
|
|
374 | (1) |
|
|
375 | (40) |
|
Keys and Comparable Types |
|
|
375 | (2) |
|
|
377 | (3) |
|
|
380 | (3) |
|
|
383 | (4) |
|
|
387 | (3) |
|
|
390 | (5) |
|
|
395 | (2) |
|
|
397 | (3) |
|
|
400 | (3) |
|
|
403 | (12) |
|
|
409 | (1) |
|
|
409 | (1) |
|
|
410 | (1) |
|
|
411 | (1) |
|
|
412 | (1) |
|
Answers to Review Questions |
|
|
412 | (3) |
|
Heaps and Priority Queues |
|
|
415 | (22) |
|
|
415 | (1) |
|
|
416 | (4) |
|
|
420 | (3) |
|
A HeapPriorityQueue Class |
|
|
423 | (3) |
|
Case Study: Huffman Codes |
|
|
426 | (11) |
|
|
429 | (1) |
|
|
430 | (1) |
|
|
430 | (3) |
|
|
433 | (1) |
|
|
433 | (1) |
|
Answers to Review Questions |
|
|
434 | (3) |
|
|
437 | (42) |
|
|
438 | (4) |
|
|
442 | (2) |
|
|
444 | (2) |
|
|
446 | (3) |
|
The Speed Limit for Comparison Sorts |
|
|
449 | (1) |
|
|
450 | (4) |
|
|
454 | (4) |
|
|
458 | (4) |
|
|
462 | (2) |
|
|
464 | (2) |
|
|
466 | (2) |
|
The java.util.Arrays.sort() Method |
|
|
468 | (11) |
|
|
468 | (1) |
|
|
469 | (1) |
|
|
469 | (6) |
|
|
475 | (2) |
|
|
477 | (1) |
|
Answers to Review Questions |
|
|
478 | (1) |
|
|
479 | (28) |
|
|
479 | (3) |
|
The Adjacency Matrix Implementation |
|
|
482 | (2) |
|
The Adjacency List Implementation |
|
|
484 | (3) |
|
|
487 | (1) |
|
|
488 | (3) |
|
|
491 | (1) |
|
|
492 | (2) |
|
|
494 | (5) |
|
|
499 | (8) |
|
|
500 | (1) |
|
|
500 | (1) |
|
|
501 | (3) |
|
|
504 | (1) |
|
|
505 | (1) |
|
Answers to Review Questions |
|
|
505 | (2) |
|
Appendix A Answers and Hints |
|
|
507 | (14) |
|
|
507 | (2) |
|
|
509 | (1) |
|
|
509 | (1) |
|
Chapter 4 Programming Problems |
|
|
510 | (1) |
|
|
511 | (1) |
|
Chapter 5 Programming Problems |
|
|
512 | (1) |
|
|
513 | (1) |
|
Chapter 7 Programming Problems |
|
|
514 | (1) |
|
|
514 | (1) |
|
Chapter 8 Programming Problem |
|
|
515 | (1) |
|
|
515 | (1) |
|
|
515 | (1) |
|
Chapter 10 Programming Problem |
|
|
516 | (1) |
|
|
516 | (1) |
|
Chapter 12 Programming Problems |
|
|
517 | (1) |
|
|
518 | (1) |
|
|
519 | (1) |
|
|
519 | (1) |
|
Chapter 16 Programming Problem |
|
|
519 | (1) |
|
|
520 | (1) |
|
|
521 | (44) |
|
|
521 | (1) |
|
Compiling and Running a Java Program |
|
|
522 | (6) |
|
|
528 | (2) |
|
|
530 | (3) |
|
|
533 | (1) |
|
|
534 | (1) |
|
|
535 | (4) |
|
|
539 | (1) |
|
The new and instanceof Operators |
|
|
540 | (1) |
|
Using Command Line Arguments |
|
|
541 | (3) |
|
|
544 | (1) |
|
|
545 | (3) |
|
|
548 | (5) |
|
|
553 | (1) |
|
|
554 | (2) |
|
|
556 | (2) |
|
|
558 | (1) |
|
Abstract Methods and Abstract Classes |
|
|
558 | (2) |
|
|
560 | (5) |
|
|
562 | (1) |
|
|
562 | (1) |
|
|
563 | (1) |
|
Answers to Review Questions |
|
|
563 | (2) |
|
Appendix C Essential Mathematics |
|
|
565 | (22) |
|
The Floor and Ceiling Functions |
|
|
565 | (1) |
|
|
566 | (1) |
|
Asymptotic Complexity Classes |
|
|
567 | (2) |
|
The First Principle of Mathematical Induction |
|
|
569 | (1) |
|
The Second Principle of Mathematical Induction |
|
|
570 | (1) |
|
|
571 | (1) |
|
|
572 | (1) |
|
|
573 | (2) |
|
|
575 | (1) |
|
|
576 | (2) |
|
|
578 | (1) |
|
|
579 | (8) |
|
|
584 | (1) |
|
|
584 | (2) |
|
|
586 | (1) |
|
Answers to Review Questions |
|
|
586 | (1) |
|
Appendix D The Java Collections Frameworks |
|
|
587 | (12) |
|
The Inheritance Hierarchy |
|
|
587 | (1) |
|
|
588 | (2) |
|
|
590 | (2) |
|
|
592 | (1) |
|
|
593 | (6) |
|
|
599 | (4) |
|
|
599 | (2) |
|
|
601 | (1) |
|
|
601 | (2) |
Index |
|
603 | |