Title: A Fun Introduction
1--- A Fun Introduction
Thinking about Algorithms Abstractly
- CS 4/5703 Fall 2004
- Note This material is adapted from some online
lectures.
CS 4/5703
Lecture 1
2So you want to be a computer scientist?
3Is your goal to be a mundane programmer?
4Or a great leader and thinker?
5Boss assigns task
- Given todays prices of pork, grain, sawdust,
- Given constraints on what constitutes a hotdog.
- Make the cheapest hotdog.
Everyday industry asks these questions.
6Your answer
- Um? Tell me what to code.
With more suffocated software engineering
systems,the demand for mundane programmers will
diminish.
7Your answer
- I learned this great algorithm that will work.
Soon all known algorithms will be available in
libraries.
8Your answer
- I can develop a new algorithm for you.
Great thinkers will always be needed.
9The future belongs to the computer scientist who
has
- Content An up to date grasp of fundamental
problems and solutions - Method Principles and techniques to solve the
vast array of unfamiliar problems that arise in a
rapidly changing field
- Rudich www.discretemath.com
10Course Content
- A list of algoirthms.
- Learn their code.
- Trace them until you are convinced that they
work. - Implement them.
class InsertionSortAlgorithm extends
SortAlgorithm void sort(int a) throws
Exception for (int i 1 i lt a.length i)
int j i int B ai while
((j gt 0) (aj-1 gt B))
aj aj-1
j-- aj B
11Course Content
- A survey of algorithmic design techniques.
- Abstract thinking.
- How to develop new algorithms for any problem
that may arise.
12Course Content
- Notations, analogies, and abstractions
- for developing,
- thinking about,
- and describing algorithms
13Please feel free to ask questions!
14A survey of fundamental ideas and algorithmic
design techniques
For example . . .
15Start With Some Math
16Iterative Algorithms Loop Invariants
ltpreCondgt codeA loop
ltloop-invariantgt exit when ltexit Condgt
codeB codeC ltpostCondgt
One step at a time
Code
Relay Race
17Recursive Algorithms
18Graph Search Algorithms
19Network Flows
20Greedy Algorithms
21Recursive Back Tracking
22Dynamic Programing
23Reduction
24Useful Learning Techniques
25Read Ahead
- You are expected to read the textbook/lecture
notes before the class lecture. - This will facilitate more productive discussion
during class.
26Explaining
- We are going to test you on your ability to
explain the material. - Hence, the best way of studying is to explain the
material over and over again out loud to
yourself, to each other, and to your stuffed
bear.
27Day Dream
While going along with your day
- Mathematics is not all linear thinking.
- Allow the essence of the material to seep into
your subconscious - Pursue ideas that percolate up and flashes of
inspiration that appear.
28Be Creative
- Ask questions.
- Why is it done this way and not that way?
29Guesses and Counter Examples
- Guess at potential algorithms for solving a
problem. - Look for input instances for which your
algorithm gives the wrong answer.
30RefinementThe best solution comes from a
process of repeatedly refining and inventing
alternative solutions
- Rudich www.discretemath.com
31Youre cool! Are you free sometime this weekend?
Not interested, Bonzo. I took the initiative and
asked out a guy in my algorithm class.
32End
- ----gt Relevant Mathematics