This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1 Getting Organized 11.1 Software Engineering 2
Software Life Cycles 3Agile Methods 5Goals of Quality Software 6
1.2 Object Orientation 8The Unified Method 8
1.3 Classes, Objects, and Applications 9Classes 9Objects 16Applications 17
1.7 Comparing Algorithms: Big-O Analysis 41Big-O Notation 43Common Orders of Magnitude 45Example 1: Sum of Consecutive Integers 46Example 2: Finding a Number in a Phone Book 48
Summary 50Exercises 51
2 Abstract Data Types 632.1 Abstraction 64
Information Hiding 64Data Abstraction 65Data Levels 66Preconditions and Postconditions 67Java Interfaces 68
2.2 The StringLog ADT Specification 72Constructors 72Transformers 73Observers 73The StringLogInterface 73Using the StringLogInterface 75
2.7 Software Design: Identification of Classes 124Brainstorm 124Filter 125Scenario Analysis 125Nouns and Verbs 125Cohesive Designs 126Summation of Our Approach 126Design Choices 128
2.8 Case Study: A Trivia Game 128The Source of the Trivia Game 129Identifying Support Classes 131Implementing the Support Classes 133The Trivia Game Application 140Case Study Summation 145
Summary 146Exercises 146
3 The Stack ADT 1593.1 Stacks 160
Operations on Stacks 161Using Stacks 161
3.2 Collection Elements 163Generally Usable Collections 164
3.3 Exceptional Situations 167Handling Exceptional Situations 167Exceptions and ADTs: An Example 168Error Situations and ADTs 173
3.4 Formal Specification 175Exceptional Situations 176The Interfaces 179Example Use 182
6.6 The Binary Search Algorithm 425Improving Linear Search in a Sorted List 426Binary Search Algorithm 426Recursive Binary Search 431Efficiency Analysis 432
6.7 Reference-Based Implementations 433The RefUnsortedList Class 434The RefSortedList Class 440
6.8 Storing Objects and Structures in Files 445Saving Object Data in Text Files 445Serialization of Objects 447Serializing Structures 450Application: Song Lists 451
Summary 458Exercises 459
7 More Lists 4737.1 Circular Linked Lists 474
An Unsorted Circular List 475The CRefUnsortedList Class 476Circular Versus Linear Linked Lists 482
7.2 Doubly Linked Lists 483The Add and Remove Operations 484
7.3 Linked Lists with Headers and Trailers 4877.4 A Linked List as an Array of Nodes 488
Why Use an Array? 488How Is an Array Used? 489
7.5 A Specialized List ADT 497The Specification 498The Implementation 499
7.6 Case Study: Large Integers 504The LargeInt Class 508Addition and Subtraction 510
10.4 More Sorting Considerations 710Testing 710Efficiency 710Objects and References 712Using the Comparable Interface 712Using the Comparator Interface 713Stability 719
10.5 Searching 720Linear Searching 720High Probability Ordering 721Sorted Lists 722
10.6 Hashing 722Collisions 726Choosing a Good Hash Function 734Complexity 737
Summary 738Exercises 739
Appendix A Java Reserved Words 749Appendix B Operator Precedence 750Appendix C Primitive Data Types 751Appendix D ASCII Subset of Unicode 752Appendix E Application of Programmer Interfaces for the