Feb 9
Discuss the linked list homework due today.
Walk through over
my answer.
Talk about some uses for a stack:
- balancing (), [], {}, as discussed in the text.
- as part of a "push down automata", one model of a computing machine from the Formal Languages (advanced) class.
- in an RPN calculator like the HP 11 C (which I have on my iphone ...)
- the "function frame stack" in a typical modern computer's memory
- the PostScript programming langauge (among others) which uses a stack for function inputs and outputs.
Questions?
next chapter : recursion
Our next chapter looks at one of the fundamental approaches to writing an algorithm: recursion.
Often times a problem that looks complicated may be able to be solved with a simple recursive algorithm.
This week - and perhaps more than one week,
there's some real meat here - we'll look
at the "Recursion" chapter of the text.
Topics include
- basic concepts
- implementing an algorithm recursively
- loops vs recursion
- problem: base conversion
- implement with recursion
- implement with a stack (similar to how OS does functions generally)
- turtle graphics & fractals
- problem: towers of hanoi
- problem: maze exploration
- ... with recursive turtle
- algorithm design strategies
- brute force
- greedy
- divide and conquer
- dynamic programming & memoization
- problem: making change with coins
- some coin types are easy (work with greedy), others not
- "search" - note many of these problems are about good ways to search through some abstract space for the answer. This will be a recurring theme.
We will talk about this material next week, and perhaps start some of it today.