Unformatted text preview:

02 01 2013 CMSC132 Destructor Method with name finalize Returns void Contains action performed when object is freed Invoked automatically by garbage collector The code following is executed no matter what exception is thrown Initialization Block Block of code used to initialize static instance variables for class Enables complex initialization for static variables Control flow Exceptions Share code between multiple constructors for same class Class Foo Static A 1 A 2 static initialization block initialization block Constructor can override any initialization Final can be used for constant variables methods and classes Final makes them unchangeable UML Unified Modeling Language is a modeling language for object oriented software that allows us to specify visualize construct and document systems Public Private Protected package Aggregation relationship has a relationship Public class Name extends Exception to create an exception Methods are declared when a method throws the exception in the signature Iterable is not the same as iterator Iterator uses next hasNext remove Iterable just implements an iterator for each loop Event driven programming where an action occurs outside normal flow of control of programs Swing AWT is system dependent and is a library Java 2d graphic library Event Dispatching Threat EDT is a background thread to process GUI events 2 20 million 2 30 billion The base does not matter with logarithmic equations here Big O is a tool to compare algorithms and is used when the values of n are big Memorize complexities P NP Problems so hard that it would take a computer so long to do it polynomial time Creating array for generic type T data T new Object size Midterm II Topics Big O execution Generics limits assignments LINKEDLIST 3 traversals recursions not recursive all versions of maps sets which is more effficent when should i use a certain one over the other Map associative array drop restriction on array parameter 1 set collection of values last element traversal while curr next null Know the 7 components of software life cycle Can be executed in different ways testing before building software Waterfall model go in order Iterative development iterate over all components putting different amount of times in each using what you know from previous cycle you can improve it embrace change Questions to ask at company are you doing extreme programming Pipes and filters organize data where data is passed around Blackboard modules act on data Threads Process is just running the program o Threads are inside each process Program counter what will be executed next the stack and pc define a thread it also tells you where you were on the stack Scheduler tells one thread to stop so another thread can be run it s the schedulers choice not the programmer Threads are used to organize conclusions one object can be represented several different ways by making each new representation a thread The start method should have been called get in line meaning it isn t run right away Event dispatching thread is most important thread in GUI Interpreter most simple as simple as possible o Based on console not gui Threads should use one lock Dijkstras Check neighbors that are not already in the set Then find the node with the lowest cost does not have to be neighbor of origin Add all nodes to set even if they re not connected Use predecessors to find the path Only valid with one starting point you need multiple C is value if statement is if the path can be better if not then If cost stays at infinity there is no path to it don t do anything Stop when you find the shortest path to the point of interest when the point of interest is in the set Graphs are the most generic form of structure Adjacency Property LinkedList is a queue and a stack Project 8 Array of Maps Map String Map String Double HashMaps Use maps to keep track of object and object s info For project don t use recursive DFS algorithm USE Adjacency map Breadth first search o Add original to queue then process by check neighbors o If the neighbor has not been processed then add it to the queue overlaps do not matter in the queue because you always check to see if its processed For depth first search o Use stack instead of queue For toString don t implement sort method take from his slides Wrap around maps and sets with ordered maps and sets for toString method Final On it o MVC event driven programming observer o Object Oriented Principles Abstraction Allows us to control complexities procedural what to no but not how data How to design system based on provided descriptions Classes nouns and interfaces needed Variables verbs review this from slides o Algorithmic Complexity Why use it Easier than benchmarking expensive and a lot of time and get a sense of how good an algorithm is Review code examples for Big O o Linear Data Structures Arrays and LinkedLists traditional head project head tail BE FAMILIAR WITH BOTH Recursion 99 of the time you need an auxiliary problem Parameters for LinkedList will be auxHead Public class LinkedList public LinkedList process LinkedList t new LinkedList t head set head return t o Sets Map Different types TreeMap sorted vs HashMap most efficient Hash Equals code o Trees Code on website for all k o Software development Kinds of testing Process Models o Architecture Pipes and filters compiler Blackboard o Graphs No implementation o Sorting o Java Know Big Os Be able to look at graph for BFS DFS Dijkstras 2nd to last slide format EX what it looks like after 2 things are added to processed set Comparable compare s1 s2 vs comparator compareTo s1 Abstract classes vs interfaces Always try to use interface only method declaration no instance variables Abstract push code up avoid code duplication you can have method definition Iterable vs iterator Not on it o UML wrap a hashset into treeset


View Full Document

UMD CMSC 132 - Notes

Documents in this Course
Recursion

Recursion

12 pages

Sorting

Sorting

31 pages

HTML

HTML

7 pages

Trees

Trees

19 pages

HTML

HTML

18 pages

Trees

Trees

19 pages

Honors

Honors

19 pages

Lecture 1

Lecture 1

11 pages

Quiz #3

Quiz #3

2 pages

Hashing

Hashing

21 pages

Load more
Download Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?