welcome n.
Skip this Video
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 72

Welcome - PowerPoint PPT Presentation

  • Uploaded on

Thinking about Algorithms Abstractly. Welcome. Jeff Edmonds www.cse.yorku.ca\~jeff\courses\3101 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413 . Jeff Edmonds York University. Lecture 1. COSC 3101. Course Material. Videos Of my lectures Fall 2011. Slides. Text.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Welcome' - raine

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Thinking about Algorithms Abstractly


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

jeff@cse.yorku.caCSB 3044, ext. 33295


Jeff Edmonds

York University


COSC 3101


Course Material

Videos Of my lectures Fall 2011



Steps, Assignments, Practice Tests, Unit Tests, Exam

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

Good to have, but not needed for this course.


Course Material



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.
a contract to learn
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.

tough love
Tough Love

Last year and this summer, I threatened them every day.

They performed better than ever before!

And my course evaluations were better.

think about algorithms abstractly
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.

study now
Study Now!

You spend 50hrs/week on your programming course.

People do work hard on my assignments.

But they don’t really study the material deeplyuntil they fail the midterm.


We will work you HARD:

  • 6 assignments
  • 5 practice tests
  • 5 unit tests
  • Participation
  • An exam
  • Mark =


0%  -4%   

4%*5=20%  11%*5=55%   

2%  10%  

35%  78%  

Σi=1..5 [ 0.04 Ti + 0.07 Max(Ti,E) ] 

+ [ 0.02 P + 0.08 Max(P,E) ] + 0.35 E 


5 unit tests:

  • Each unit test, half the class fails. “Fail early, fail often”
  • Then almost everyone starts to listen and passes the exam.
  • Don’t want to people who fail the midterms to give up
  • Want people to work on the midterms

4%*5=20%  11%*5=55%   

7% max(Ti,E)

4% Ti


Class Participation:

  • Asking/Answering questions in class
  • Attending office hours
  • Talking to me outside of class
  • Submitting a photo *

Σi=1..5 [ 0.04 Ti + 0.07 Max(Ti,E) ] 

+ [ 0.02 P + 0.08 Max(P,E) ] + 0.35 E 



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



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

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



Some students feel too intimidated to talk to the professor.

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



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.

boss assigns task
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.

your answer
Your answer:
  • Um? Tell me what to code.

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

your answer1
Your answer:
  • I learned this great algorithm that will work.

Soon all known algorithms will be available in libraries.

your answer2
Your answer:
  • I can develop a new algorithm for you.

Great thinkers will always be needed.

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

int j = i;

int B = a[i];

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

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


a[j] = B;


course content1
Course Content
  • A survey of algorithmic design techniques.
  • Abstract thinking.
  • How to develop new algorithms for any problem that may arise.
  • Many experienced programmers were asked to code up binary search.
  • Many experienced programmers were asked to code up binary search.

80% got it wrong

Good thing is was not for a nuclear power plant.

what did they lack1
What did they lack?
  • Formal proof methods?
what did they lack2
What did they lack?
  • Formal proof methods?

Yes, likely

Industry is starting to realize that formal methods are important.

But even without formal methods …. ?

what did they lack3
What did they lack?
  • Fundamental understanding of the algorithmic design techniques.
  • Abstract thinking.
course content2
Course Content

Notations, analogies, and abstractions

for developing,

thinking about,

and describing algorithms

so correctness is transparent

some math

Logic Quantifiers

Logs and Exps

g "b Loves(b,g)"b g Loves(b,g)

2a× 2b = 2a+b2log n = n


Classifying Functions

Time Complexity

f(i) = nQ(n)

t(n) = Q(n2)

Input Size

Adding Made Easy

Recurrence Relations

∑i=1 f(i).

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

Some Math
iterative algorithms loop invariants







9 km

5 km

Iterative Algorithms Loop Invariants





exit when <exit Cond>




One step at a time


Relay Race

greedy algorithms
Greedy Algorithms





  • Rudich www.discretemath.com

Course Material



Course Material


  • For each unit, I spoon feed you the key ideas from each unit as a set of steps.
  • Learn them! Understand them!
  • With only them, you are on your way to passing. Without them, you are on your way to failing.
  • Lectures consists of many examples of using these steps.

Assignments: Practice key ideas. Do them!

Practice Tests: Do them!

Text “How to Think about Algorithms”: Buy it and read it.


Book Slides Videos


  • 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.

Book Slides Videos


  • REALLY good students might feel they don’t have to come to class (some might be right).


  • Cocky students will think they don’t need to come classbut are wrong.
  • Lazy students will use them as an excuse to skip classand then never really get to them.

Test every other week!Cant be delayed.


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, …

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.

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)


Useful Learning Techniques

Please ask questions!


Useful Learning Techniques

Please ask questions!

  • To keep the flow going
  • Wiggly hand: relevant to current slide.
  • Stationary hand:question about past material.

Useful Learning Techniques

When I ask a question to the class.

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


Useful Learning Techniques

In every class,there is one studentI don’t like.

The key when talking in class is

Are you trying to help me and the classor win some compitition?


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

10% of your mark is class participation!


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 don’t recognize.

Make yourself KNOWN today to SOME professor.


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 don’t recognize.

Make yourself KNOWN today to SOME professor.

Sorry email does not help as I don’t remember names


Submit a Photo

  • 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 3101 photos Smith_John.jpg
    • Forum
    • - Upload a photo to your Forum Avatar.


  • 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.
  • Be sure to subscribe to the course forum and not just to one of its topics



Iterative Algorithms

read ahead
Read Ahead

You are expected to read the lecture notesbefore the lecture.

This will facilitate more productive discussionduringclass.

Also please proof readassignments & tests.

Like in an English class

We are going to test you on yourability to explain the material.

Hence, the best way of studying is to explain the material over and over again out loud toyourself, to each other, and to your stuffed bear.

day dream

While going along with your day

Day Dream

Mathematics is not all linear thinking.

Allow the essence of the materialto seepinto your subconscious

Pursue ideas that percolate up and flashes of inspiration that appear.

be creative

Be Creative

Ask questions.

Why is it done this way and not thatway?

guesses and counter examples
Guesses and Counter Examples
  • Guess at potential algorithms for solving a problem.
  • Look forinput instances for which your algorithm gives the wrong answer.
  • Treat it as a game between these two players.
Refinement:The best solution comes from a process of repeatedly refining and inventing alternative solutions
  • Rudich www.discretemath.com


This term we will provide two 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


This term we will provide two 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.



I will take attendance!This will effect your participation mark!

Yes!I will be sure to attend.



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.



Lets schedule the office hours now.