SUNY Geneseo Department of Computer Science
{Date}
CSci 141, Spring 2004
Prof. Doug Baldwin
SOFI's
Making up the lost tests
End of semester info
Proof for constructor in this week's lab could use strong induction
If you somehow wrote constructor without recursion you can still use induction
Chapter 17
Where next?
What does it mean for algorithm to analyze other algorithm/method
Check for non-terminating programs?
Tractable = solution computable in reasonable time
Intractable = not computable in reasonable time
Undecidable = not computable
What is "computable?"
General solution to halting problem doesn't exist
Incompleteness of mathematics
Turing machine = mathematical model of computer
Demonstration Program with stub Halting Detector
Moral: computer science has limits, but it can identify those limits
Questions?
List of lists, want first element of first list
Design an algorithm that operates on a list and returns a new list containing the 1st, 3rd, 5th, etc. elements of it
// In some subclass of List...
List everyOther()
if ( this.isEmpty() )
return this.makeNewList()
}
else {
if ( this.getRest().isEmpty() ) {
subList = this.makeNewList()
}
else {
subList = this.getRest().getRest().everyOther()
}
subList.addItem( this.getFirst() )
return subList
}
}
(No More Lectures Available)