Professional Documents
Culture Documents
DueNextWeek:
Assignment0 Scan/ReadChapter1and2 ReadChapter3 EspeciallyRecursionifthisisnew ReadChapter4
5th Edition
Physical -- Whatever you can find it for. One time download on Wiley -- $60 CourseSmart eBook (Rental) -- $47 - $60
Syllabus
MaybeIshouldreaditaloud,linebyline Whatarequizzes? Keepupwiththereading,trytoscanthedayschapteronce throughoncebeforeclass. Myjob:highlight,clarifyandexplain Assignmentsareduebeforethestartofclassontheassigned date.Lateworkwillbepenalized. Basically:Read,ShowUp,turninyourassignmentsontime.
2/1/2014
Assignment 0
Needleinahaystack
UsethesuppliedInput/Output formatforfullcredit. Part1 findtheNeEDle Part2 abinaryneedle00000000
2/1/2014
Object thethinginRAM Type whatkindofObject Class thethingthatdefinesthetype InstanceVariables/Fields accessible aspectsofatype Classmodifiers abstract,final,public, private
Base(Primitive)Typesvs.Objects
int vs Integer *Stackvs Heap
Objectcreationandreferences
IntegermyAge =newInteger(); IntegermyTwinsAge =myAge;
Enums
2/1/2014
Controlflow
If,Else while,Do while For Switch
RemembertheseIhopeso
Break/continue
2/1/2014
Pseudocode
ItsJava,butitsnotJava
Chapter 2 OO Design
Abstraction
2/1/2014
HasA
containment
Overriding methods
Refinement replacement
RememberThrows,TryCatch,etc.
2/1/2014
Narrowing(downcasting)
Vehiclev=newVehicle(); Truckt =v;//Compile ERROR Truckt=newTruck(); v=t; //Ok,seeabove LoadTruckBed (v);//CompileErrorvisnotatruck LoadTruckBed ((Truck)v);//ok,butonlybecausevisreallyatruck!
Break
Syllabus Assignment0 NextWeek Chapter1 Chapter2 Break Chapter3 Assignment1 TwoWeeks
2/1/2014
Indirectapplications
Auxiliarydatastructureforalgorithms Componentofotherdatastructures
node
23
24
Linked Lists
Linked Lists
2/1/2014
Linked Lists
25
26
Linked Lists
27
2/1/2014
NodesimplementPositionandstore:
element linktothepreviousnode linktothenextnode
prev
next
header
nodes/positions
trailer
elements
WevisualizeoperationinsertAfter(p,X),whichreturnspositionq
A p A p A
B X q B X
AlgorithmaddAfter(p,e): Createanewnodev v.setElement(e) v.setPrev(p) {linkvtoitspredecessor} v.setNext(p.getNext()) {linkvtoitssuccessor} (p.getNext()).setPrev(v) {linkpsoldsuccessortov} p.setNext(v) {linkptoitsnewsuccessor,v} returnv {thepositionfortheelemente}
Lists
Insertion Algorithm
Lists
Insertion
Lists
Specialtrailerandheadernodes
elem
node
28
29
30
10
2/1/2014
Wevisualizeremove(p),wherep=last()
p C C D
A A
B B
p D
Algorithmremove(p): t=p.element {atemporaryvariabletoholdthe returnvalue} (p.getPrev()).setNext(p.getNext()) {linkingoutp} (p.getNext()).setPrev(p.getPrev()) p.setPrev(null) {invalidatingthepositionp} p.setNext(null) returnt
Singleinthebook,butcouldbe double
elem
node
33
Linked Lists
Lists
Deletion Algorithm
Lists
Deletion
31
32
11
2/1/2014
Algorithmremove(p): t=p.element {atemporaryvariabletoholdthe returnvalue} (p.getPrev()).setNext(p.getNext()) {linkingoutp} (p.getNext()).setPrev(p.getPrev()) p.setPrev(null) {invalidatingthepositionp} p.setNext(null) returnt
Singleinthebook,butcouldbe double
elem
node
35
AnalysisofAlgorithms
Linked Lists
Lists
Deletion Algorithm
34
12
2/1/2014
My Availability
Syllabus Assignment0 NextWeek Chapter1 Chapter2 Break Chapter3
Questions?Help?
Cell:262.320.7778 Email:sartoa@uwp.edu
DueNextWeek:
Assignment0 Scan/ReadChapter1and2 ReadChapter3 EspeciallyRecursionifthisisnew ReadChapter4
13