Mon, Nov 13 |
|
Types of questions |
|
Study advice |
|
Course material | Object-oriented design classes & objects highly cohesive each class maps to a single, well-defined entity each method of the class maps to a single, well-defined behavior loosely coupled each class is largely independent and interacts via well-defined interface method behavior should not depend upon coordination with other methods Java features data structures ArrayLists vs. arrays parallel lists vs. lists of structured objects examples: WordFreq, UFOlookup, CityLookup interacting classes exception handling throwing an exception vs. try-catch input/output Scanner class used to read from keyboard (System.in) or a file (File object) methods: hasNext, next, hasNextLine, nextLine, hasNextInt, nextInt, close, ... System.out.format, format string (e.g., %8s, %-8s, %.2f, %6.2f) generics generic interface/class, e.g., Comparable, ArrayList generic methods, e.g., Collections.reverse, Collections.sort interfaces defining & implementing an interface, polymorphism examples: Comparable, List Searching and efficiency sequential search vs. binary search worst case vs. average case vs. best case performance timing performance, System.currentTimeMillis Collections.binarySearch applications: Dictionary, CityStats/CityLookup Big-Oh notation sequential search is O(N), binary search is O(log N) rate-of-growth behavior Sorting and recursion recursion base case(s), recursive case(s) avoiding infinite recursion & redundancies Dr. Seuss analogy insertion sort vs. selection sort vs. merge sort vs. quick sort worst case vs. average case vs. best case performance application: Dictionary class, lazy add approach Big-Oh analysis insertion & selection sorts are O(N2), merge & quick sorts are O(N log N) rate of growth behavior |