1 welcome jeff edmonds york university lecture 0 cosc 2011 jeff edmonds \~jeff\courses\2011...

59
1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds .cse.yorku.ca\~jeff\courses\2011 [email protected] CSB 3044, ext. 33295 416-538-7413

Upload: rudolf-eaton

Post on 28-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

1

Welcome

Jeff Edmonds

York UniversityLecture 0 COSC 2011

Jeff Edmonds www.cse.yorku.ca\~jeff\courses\2011

[email protected] 3044, ext. 33295

416-538-7413 

Page 2: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

2

Steps, Assignments, Practice Tests, Unit Tests, Exam

SlidesVideos

(Remind me)

Extra Text: Cormen, Leiserson, Rivest, and Stein  "Introductin to Algorithms",

Good to have, but not needed for this course.

Course Material

TextText

Page 3: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

3

Course Material

www.cse.yorku.ca\~jeff\courses\2001\syllabus

Page 4: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

4

• What do you think about 3101?

Hey Jeff,Never thought I would say this but I missed you a little bit.I was able to solve some interesting business programming problems - all by myself by just thinking back to the course. The main thing I got out of the course is belief in higher self and the ability to relax.If taken professionally, you weren't kidding that the course would be helpful for us in life and not just academically.

Page 5: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

5

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.

A Contract to Learn

Everyone can learn it.

Page 6: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

6

The last few termsI threatened them every day.

They performed better than ever before!

And my course evaluations were better.

Tough Love

Page 7: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

7

Think about Algorithms Abstractly

Devastated by the midterm

Change your thinking now.

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

Page 8: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

8

Don’t just work on coding assignments!

Study Now!

Study the material deeplybefore you fail the midterm.

Page 9: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

9

We will work you HARD:• 4 Assignments• Midterm • Exam• Participation• Mark =

Marks

50% 54%   

2% 10%  

Σi=1..5 0.05 Ti + 0.20 M + 0.50 E + 0.02 P+ 0.08 Max(M,E,P)

4%*5 = 20%   

20% 24%   

Page 10: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

10

In 3101, I have 5 unit tests:

• Each unit test, half the class fails. “Fail early, fail often”

• Then almost everyone starts to listen and passes the exam.

• But we need the TAs to mark the assignments .

Marks

Page 11: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

11

Four coding assignments (in Java)• Start them early!• Talk to each other• Don’t copy• Do assignments in pairs.

Marks

Page 12: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

12

Class Participation:

• Asking/Answering questions in class

• Attending office hours

• Talking to me outside of class

• Submitting a photo *

• Worth 2% if you don’t need it and 10% if you do.

Marks

Page 13: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

13

I think it is important for people to not feel isolated with the material.

Together

Page 14: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

14

You’re cool! Are you free sometime this weekend?

Yes!The best way to learn is to teach each other!

Together

Page 15: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

15

Some students feel too intimidated to talk to the professor.

Actually, he is just a guywho has been doing this for

a while.

Together

Page 16: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

16

Office hours: Before/after class tend to be the best time.Longer or private questions, when requested, can be taken back to my office, CSB 3044.

Together

Page 17: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

17

Pros• Don’t have to take notes.• Lower fear level that you will miss something.• Flexible to miss a class or two

if working, parenting, sick, …• Read/watch ahead to be prepared for a good discussion.• Read/watch after to review and as a reference.

Together

Page 18: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

18

Pros• REALLY good students might feel they don’t have to

come to class (some might be right).

Cons• Cocky students will think they don’t need to come class

but are wrong.• Lazy students will use them as an excuse to skip class

and then never really get to them. Test every other week!Cant be delayed.

Together

Page 19: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

19

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)

Together

Page 20: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

20

Please ask questions!

To keep the flow going

• Wiggly hand: relevant to current slide.

• Stationary hand: question about past material.

• Avoid getting off topic.

Together

Page 21: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

21

When I ask a question to the class.

Please don’t shout out answers. So others can think.

Together

Page 22: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

22

In every class,there is one student

I don’t like.

The key when talking in class is

Together

Are you trying to help me and the class

or win some compitition?

Page 23: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

23

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 everyone’s sake.

Please ask questions!

Together

10% of your mark is class participation!

Page 24: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

24

• What: • Submit a photo on line• Add a photo to your forum account• If you would like a better rapport with your emails,

please include a photo.• Why:

• I am very bad with names. (Sorry)• Emails and tests are effectively anonymous.• Needed for 10% participation mark. • You can see the class list.

• How:• Submit

     - cp photo.jpg Smith_John.jpg  - submit 2011 photos Smith_John.jpg (or line)

Submit a PhotoTogether

Page 25: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

25

• I communicate to you via the Forum. • You are also encouraged to talk to each other this way. • To be sure that you know when something has been

posted, it is important to subscribe to the course forum.

Forum

• Be sure to subscribe to the course forum and not just to one of its topics

Together

Page 26: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

26

When you email me something I need to make a note about send me your cse account. That way I can put it in epost notes and you can see that I have made it.

Together

Page 27: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

27

So you want to be a computer scientist?

Page 28: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

28

Is your goal to be a mundane programmer?

Page 29: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

29

Or a great leader and thinker?

Page 30: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

30

Original Thinking

Page 31: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

31

Boss assigns task:

– Given today’s prices of pork, grain, sawdust, …– Given constraints on what constitutes a hotdog.– Make the cheapest hotdog.

Everyday industry asks these questions.

Page 32: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

32

• Um? Tell me what to code.

With more sophisticated software engineering systems,the demand for mundane programmers will diminish.

Your answer:

Page 33: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

33

Your answer:

• I learned this great algorithm that will work.

Soon all known algorithms will be available in libraries.

Page 34: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

34

Your answer:

• I can develop a new algorithm for you.

Great thinkers will always be needed.

Page 35: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

35

Course Content

• A list of algorithms (mostly for data structures)

– 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 < a.length; i++) {

int j = i;

int B = a[i];

while ((j > 0) && (a[j-1] > B)) {

a[j] = a[j-1];

j--; }

a[j] = B;

}}

Sorry

Page 36: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

36

Course ContentAn intro to: • Algorithmic design techniques.• Abstract thinking.• How to develop new algorithms for any

problem that may arise.

Page 37: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

37

Study:

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

Page 38: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

38

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.

Page 39: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

39

What did they lack?

Page 40: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

40

What did they lack?

• Formal proof methods?

Page 41: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

41

What did they lack?

• Formal proof methods?

Yes, likely

Industry is starting to realize that formal methods

are important.

But even without formal methods …. ?

Page 42: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

42

What did they lack?• Fundamental understanding of the

algorithmic design techniques.• Abstract thinking.

Page 43: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

43

Some Math

Recurrence RelationsT(n) = a T(n/b) + f(n)

Input Size

Tim

e

Classifying Functionsf(i) = nQ(n)

Adding Made Easy∑i=1 f(i).

Time Complexityt(n) = Q(n2)

Logic Quantifiers g "b Loves(b,g)"b g Loves(b,g)

Logs and Exps

2a × 2b = 2a+b

2log n = n

Page 44: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

44

Iterative Algorithms Loop Invariants

i-1 i

ii0

T+1<preCond> codeA loop <loop-invariant> exit when <exit Cond> codeBcodeC<postCond>

9 km

5 km

Code Relay RaceOne step at a time

Page 45: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

45

Recursive Algorithms

?

?

Page 46: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

46

Graph Search Algorithms

Page 47: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

47

End

Page 48: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

48

Together

Page 49: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

49

Read Ahead

You are expected to read the lecture notes before the lecture.

This will facilitate more productive discussion during class.

Like in an English class

Also please proof readassignments & tests.

Page 50: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

50

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.

Page 51: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

51

Day Dream

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.

While going along with your day

Page 52: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

52

Be Creative

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

Page 53: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

53

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.

Page 54: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

54

Refinement:The best solution comes from a

process of repeatedly refining and inventing alternative solutions

Rudich www.discretemath.com

Page 55: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

55

This term we will provide two hours a week of contact hours

with the TA.

Together

Ask me anything!• Class material• Help YOU solve the assignment

questions.• Material missed from previous

courses• Your love life

Page 56: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

56

This term we will provide two hours a week of contact hours

with the TA.

Yes!I will be sure

to attend.

Together

We can have• Practice Tests• Lectures• One-on-one time• Group discussions

Page 57: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

57

I will take attendance!

This will effect your participation mark!

Yes!I will be sure

to attend.

Together

Page 58: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

58

Sorry!I will not have time

to mark the assignments.

This might be better anyway.

Together

But we can I read your solution together during the TA hours.

Page 59: 1 Welcome Jeff Edmonds York University Lecture 0 COSC 2011 Jeff Edmonds \~jeff\courses\2011 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413

59

Lets schedule the office hours now.

Together