welcome to algorithms!ltoma/teaching/cs231/fall...introduction to algorithms, third edition by...

19
Welcome to Algorithms! Q. How did a programmer die in the shower? A. She read the shampoo bottle instructions: Lather. Rinse. Repeat.

Upload: others

Post on 29-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Welcome to Algorithms!

Q. How did a programmer die in the shower?

A. She read the shampoo bottle instructions: Lather. Rinse. Repeat.

Page 2: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Algorithms

• A step-by-step procedure for solving a problem in a finite number of steps

• Ethymology: after Muhammad Al-Khwārizmī, 9th century Muslim mathematician and astronomer

• Known from antiquity • E.g. Euclid’s algorithm for finding g.c.d.

Al-Khwārizmī, from a U.S.S.R. postage stamp, 1983.© Juulijs/Fotolia

Page 3: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Class Overview

• This class is an introduction to problem solving through the design and analysis of algorithms • We’ll introduce fundamental algorithmic problems • We’ll discuss ideas for solving these problems • We’ll argue that these solutions are correct • We’ll compare the solutions by analyzing their efficiency

Page 4: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Outline

• Analysis: Asymptotic notation, summations and recurrence • Fundamental data structures

• search trees, balanced search tree, [augmented search trees], heaps/priority queues, [skip lists] and union-find

• Fundamental problems and algorithms • searching, sorting (insertion sort, mergesort, quicksort, counting sort,

bucket sort), selection • optimization problems • graph problems

• Lower bounds • Fundamental techniques

• divide-and-conquer, greedy, dynamic programming

Page 5: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Resources

• Suggested textbook

Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein

• Another good textbook

• Multiple copies available in Searles 224 • Many online resources

Page 6: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Labs

• Weekly labs • usually on Fridays, but could swap with lecture occasionally

• Lab time dedicated to more examples, demos and practice problems • will contain a set of problems to be solved in the lab • a set of homework problems

• Usually the homework part of a lab is due at the next lab • unless otherwise specified

• Approx. 10 labs throughout the semester

Page 7: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Work for the class and grading policy

• Final grade • Homework assignments (40%) • 3 exams (60%) • class participation

• Exams: • not cumulative (as much as possible) • in-class & take-home • open notes • Exam 1: October 7th, right before fall break • Exam 2: beginning November • Exam 3: December 17th (check final exam date in polaris)

Page 8: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Work for the class and grading policy

• Collaboration policy • Group work encouraged • Limit your collaborators to <=3 • Write your solutions individually • Write the names of your collaborators on the first page of the homework

• Late policy • Late assignments are not accepted (except for medical reasons).

Page 9: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Office hours, TAs and study groups

• An amazing group of TA’s will have weekly office hours • Clara Hunnewell • Grace Handler • Ethan Zhou • Tucker Gordon • Jack Ward • Jason Nawrocki

• Study group location: Searles 224

• Precise schedule TBD shortly • Sundays: ?? • Wednesdays: ?? • Thursdays: ??

Page 10: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

This is a hard class!

• Coming up with algorithms is more of an art than a science • no algorithms for how to come up with algorithms! • highly creative • each problem is different • furthermore, similar problems can have very different solutions

• Algorithms require a lot of abstraction • and thinking at different levels of abstraction

Page 11: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

What you can expect from me

• Goal is not to cover a bunch of algorithms, but rather to emphasize the process of coming up with solutions. This process is not necessarily neat, and not straightforward; it involves going back and forth, possibly many times, and struggling.

• I will rarely start a class by presenting the algorithm. Instead, I will start by posing the problem, and asking for ideas.

• We'll try to understand properties of the problem, and, as a group, we'll try to come up with solutions and refine them.

• Sometimes it is very effective to see wrong solutions, or ideas that lead nowhere.

• Messy boards • But, I will bring lecture notes!

Page 12: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

What you can expect from me

• As we come up with solutions, we'll try to generalize and derive "techniques" that we can apply to other problems. The most important skill to learn is abstraction and the ability to think critically.

• All material for the class available online at

http://www.bowdoin.edu/~ltoma/teaching/cs231/fall16/

• Class consistent with Algorithms classes at peer colleges

Page 14: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

What I expect from you

• The course relies heavily on group work and peer instruction, so it is crucial that you attend all classes and all labs and stay engaged.

• In class • stay engaged and ask questions • collaboration, not competition • offer help on alternate explanations for your peers

• At home • Find a group of peers and work together: There is a lot of research that shows the

benefits of peer instructions compared to standard lecturing. The process of explaining an argument is beneficial for everybody involved.

• Be pro-active about studying; use class materials and resources on the internet • Solve all problems that are assigned in class and lab, even those that are optional • Struggle: When you first attempt a problem, try to figure out yourself if a solution is

correct, or find a counter-example • Attend study groups

Page 15: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Class Outcome

• Appreciation of algorithms and their importance • Familiarity with basic algorithms and techniques • The most important skill to learn is abstraction and problem solving • Solve new problems!

Page 16: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

My research

Page 17: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

My research

Page 18: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another
Page 19: Welcome to Algorithms!ltoma/teaching/cs231/fall...Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein • Another

Outline

• Today • Introduction • Questionnaires

• Tomorrow in lab • Analyzing algorithms • Case studies: bubble sort, selection sort, insertion sort

• Tue 9/6: • Asymptotic analysis and asymptotic notation

• Thu 9/8: • Summations

• Friday 9/9: • Lab 1 (due Friday 9/16)