Link
Data Structures and Algorithms
Applying data structures and algorithms to solve problems.
Kevin Lin, with thanks to many others.
1
Ask questions anonymously on Piazza. Look for the pinned Lecture Questions thread.

Algorithm Design Process
Hypothesize. How do invariants affect the behavior for each operation?
Identify. What strategies have we used before? What examples can we apply?
Plan. Propose a new way from findings.
Analyze. Does the plan do the job? What are potential problems with the plan?
Create. Implement the plan.
Evaluate. Check implemented plan.
Find a lower and upper bound. Define a slow but totally correct solution. Build a mental model: identify key properties.
Consider each algorithm that you know. Which ones might work? How do the existing algorithms break down?
Apply an algorithm design idea. Perform a reduction: transform input and output. Or modify the data structures used.
Use an algorithm design paradigm.
2

Graph Modeling
3
How to model vertex weights?
Shortest Paths (Robert Sedgewick, Kevin Wayne/Princeton)
How to model multiple sources and sinks?

Line Segmentation
Suppose we’re building an optical character recognition system.
We want to separate lines of text. There is some white space between the lines but problems like noise and the tilt of the page makes it hard to find.




How can we do line segmentation?
4
Q
The Algorithm Design Manual (Steven Skiena/Springer)

Counting Inversions
Given a permutation of length N, count the number of inversions.


3 inversions: 2–1, 3–1, 7–6

Lower bound? Upper bound? Desired runtime? Algorithm paradigm?
5
Q
Algorithms (Robert Sedgewick, Kevin Wayne/Princeton)
0
2
3
1
4
5
7
6