Thinking about Algorithms Abstractly - PowerPoint PPT Presentation

1 / 61
About This Presentation
Title:

Thinking about Algorithms Abstractly

Description:

Tough Love. 7. Think about Algorithms. Abstractly. Devastated. by the midterm ... Your love life. 14. This term we will provide. three hours a week of contact ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 62
Provided by: JeffEd3
Category:

less

Transcript and Presenter's Notes

Title: Thinking about Algorithms Abstractly


1
Welcome
Thinking about Algorithms Abstractly
Jeff Edmonds York University
Lecture 1
COSC 3101
2
Jeff Edmonds www.cse.yorku.ca\jeff\courses\3101
jeff_at_cse.yorku.caCSB 3044, ext. 33295 
Office hours after class tend to remain outside
the class room. Longer or private questions,
when requested, can be taken back to my office,
CSB 3044. If no one asks, I may or may not rush
back to my office. Other times by appointment or
email.  
3
Jeff Edmonds "How to Think about
Algorithms".  Assignments http//www.cse.yorku.ca
/jeff/courses/3101/ass/ Slides
www.cs.yorku.ca/jeff/notes/3101 Cormen,
Leiserson, Rivest, and Stein  "Introduction to
Algorithms", Andy Mirzaian's on-line Lecture
Notes
4
  • What do you think about 3101?
  • Was by far the hardest course ever.
  • I got the worst midterm mark ever.
  • I almost gave up.
  • But opened a door to such an interesting world
    for me.
  • Learned to see things abstractly and from
    different angles
  • After working a few years, I realized that 3101
    was the most useful course I took.

5
A Contract to Learn
It deeply saddens me when a third of the class
does not learn the material sufficiently to pass.
I will do everything in my power to help you
learn this material.
I request that you do everything in your power.
Everyone can learn it.
6
Tough Love
Last year and this summer, I threatened them
every day.
They performed better than ever before!
And my course evaluations were better.
7
Think about Algorithms Abstractly
This course requires completely changing the way
you think about algorithms.
Though I keep warning people, they tend not to
get it until they are
Devastated by the midterm
Change your thinking now.
8
Study Now!
You spend 50hrs/week on your programming course.
People do work hard on my assignments.
But they dont really study the material
deeplyuntil they fail the midterm.
9
Midterms
  • We will work you HARD
  • 6 assignments
  • 5 practice unit tests
  • 5 unit tests (every other week)
  • An exam

0
-4 if not done
11 5 55
55

10
Together
I think it is important for people to not feel
isolated with the material.
11
Together
Youre cool! Are you free sometime this weekend?
Yes!The best way to learn is to teach each
other!
12
Together
Some students feel too intimidated to talk to the
professor.
Actually, he is just a guywho has been doing
this for a while.
13
Together
This term we will provide five hours a week of
contact hours with the TA.
  • Ask me anything!
  • Class material
  • Help YOU solve the assignment questions.
  • Material missed from previous courses
  • Your love life

14
Together
This term we will provide three hours a week of
contact hours with the TA.
  • We can have
  • Practice Tests
  • Lectures
  • One-on-one time
  • Group discussions

Yes!I will be sure to attend.
15
Together
Sorry!I will not have time to mark the
assignments.
  • But we can I read your solution together during
    the TA hours.

This might be better anyway.
16
Together
Lets schedule the office hours now.
17
So you want to be a computer scientist?
18
Is your goal to be a mundane programmer?
19
Or a great leader and thinker?
20
Original Thinking
21
Boss 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.
22
Your answer
  • Um? Tell me what to code.

With more sophisticated software engineering
systems,the demand for mundane programmers will
diminish.
23
Your answer
  • I learned this great algorithm that will work.

Soon all known algorithms will be available in
libraries.
24
Your answer
  • I can develop a new algorithm for you.

Great thinkers will always be needed.
25
Course Content
  • A list of algorithms.
  • Learn their code.
  • Trace them until you are convinced that they
    work.
  • Implement them.
  • Worry about details.

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

26
Course Content
  • A survey of algorithmic design techniques.
  • Abstract thinking.
  • How to develop new algorithms for any problem
    that may arise.

27
Study
  • Many experienced programmers were asked to code
    up binary search.

28
Study
  • Many experienced programmers were asked to code
    up binary search.

80 got it wrong Good thing is was not for a
nuclear power plant.
29
What did they lack?
30
What did they lack?
  • Formal proof methods?

31
What did they lack?
  • Formal proof methods?

Yes, likely Industry is starting to realize that
formal methods are important. But even without
formal methods . ?
32
What did they lack?
  • Fundamental understanding of the algorithmic
    design techniques.
  • Abstract thinking.

33
Course Content
  • Notations, analogies, and abstractions
  • for developing,
  • thinking about,
  • and describing algorithms
  • so correctness is transparent

34
A survey of fundamental ideas and algorithmic
design techniques
For example . . .
35
Some Math
36
Iterative Algorithms Loop Invariants
ltpreCondgt codeA loop
ltloop-invariantgt exit when ltexit Condgt
codeB codeC ltpostCondgt
One step at a time
Code
Relay Race
37
Recursive Algorithms
38
Graph Search Algorithms
39
Network Flows
40
Greedy Algorithms
NEED A PIC HERE (NOT POOH)
41
Recursive Back Tracking
42
Dynamic Programing
43
Reduction
  • Rudich www.discretemath.com

44
Useful Learning Techniques
45
Read Ahead
  • You are expected to read the lecture notes before
    the lecture.
  • This will facilitate more productive discussion
    during class.

Also please proof readassignments tests.
Like in an English class
46
Explaining
  • 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.

47
Day 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.

48
Be Creative
  • Ask questions.
  • Why is it done this way and not that way?

49
Guesses and Counter Examples
  • Guess at potential algorithms for solving a
    problem.
  • Look for input instances for which your
    algorithm gives the wrong answer.
  • Treat it as a game between these two players.

50
RefinementThe best solution comes from a
process of repeatedly refining and inventing
alternative solutions
  • Rudich www.discretemath.com

51
Useful Learning Techniques
Before reading the solutions to the
assignments.
  • Work hard on solving them on your on.
  • Study the text and slides.
  • Get help, but not answers from friends, TA,
    professor,

52
Useful Learning Techniques
After reading the solutions to the assignments.
  • Study the solutions.
  • Understand the solutions.
  • Memorize the solutions.
  • The questions on the tests will be
    different.
  • But the answers will be surprisingly close.

53
Useful Learning Techniques
Please interact with me in class.
Help me know what people are not
understanding Slow down the slides (Though we do
have a lot of material to cover)
54
Useful Learning Techniques
Please ask questions!
55
Useful Learning Techniques
Please ask questions!
  • To keep the flow going
  • Wiggly hand relevant to current slide.
  • Stationary hand question about past material.

56
Useful Learning Techniques
When I ask a question to the class.
Please dont shout out answers. So others can
think.
57
Useful Learning Techniques
Please ask questions!
Winter 06, the average of one section was much
higher than the average of the other.  (I
taught them both) My theory was that it was
because a student, Gertruda, constantly asked
great questions and everyone learned from
them. Ask questions for everyones sake.
58
Two years from now
May I have a letter of reference for grad school?
I find it awkward to write letters for people
that I dont recognize.
Make yourself KNOWN today to SOME professor.
59
Two years from now
May I have a letter of reference for grad school?
I find it awkward to write letters for people
that I dont recognize.
Make yourself KNOWN today to SOME professor.
Sorry email does not help as I dont remember
names
60
I am not good with names. Emails and test are
effectively anonymous. If you would like a
better rapport with your emails, please include a
picture within the text. ) Jeff
                       
61
End
Math
  • Iterative Algorithms
Write a Comment
User Comments (0)
About PowerShow.com