cs 330 algorithms: lecture 1

21
CS 330 Algorithms: Lecture 1 Shang-Hua Teng Department of Computer Science, Boston University

Upload: guenevere-adams

Post on 30-Dec-2015

33 views

Category:

Documents


0 download

DESCRIPTION

CS 330 Algorithms: Lecture 1. Shang-Hua Teng Department of Computer Science, Boston University. Instructors. Main Lectures: Professor Shang-Hua Teng TR 3:30 – 5:00 Sections: TF Tao Wang CAS CS330 A2 878748 Wednesday 4:00pm-5:00pm in MCS B23 CAS CS330 A3 878735 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS 330 Algorithms: Lecture 1

CS 330 Algorithms: Lecture 1

Shang-Hua TengDepartment of Computer Science, Boston University

Page 2: CS 330 Algorithms: Lecture 1

Instructors Main Lectures: Professor Shang-Hua Teng TR 3:30 – 5:00

Sections: TF Tao Wang CAS CS330 A2 878748 Wednesday 4:00pm-5:00pm in MCS B23

CAS CS330 A3 878735 Wednesday 5:00-6:00pm in MCS B23

CAS CS330 A4 865436 Thursday 2:00-3:00pm in MCS B33

Page 3: CS 330 Algorithms: Lecture 1

Office Hours

Professor Shang-Hua Teng

Email: [email protected]: MCS-276Office Hours: Tuesday 12:30-

Tuesday 12:30-2:00pm,

Thursday 12:30-2:00pm

(or by appointment)Office Phone: 358-2596

Page 4: CS 330 Algorithms: Lecture 1

Office Hours

Teaching Fellow: Tao Wang

Email: [email protected]:

Office Hours:

(or by appointment)Office Phone:

Page 5: CS 330 Algorithms: Lecture 1

Important Dates: Due day of each homework

See class webpage Quiz 1: Thursday, Oct 16 (in class) Midterm: Thursday, Nov 6 (in class) Quiz 2: Tuesday, Nov 25 (in class) Final: to be posted

Page 6: CS 330 Algorithms: Lecture 1

Grading

30% - written assignments10% - quiz 120% - midterm15% - quiz 2

25% - final

Page 7: CS 330 Algorithms: Lecture 1

Homework Write problems in order they are assigned and one

problem per page, or just try to separate them clearly so one can see the end of one problem and the beginning of the next one.

The hard-copy (paper) submissions are preferred, so, please use the gsubmit option only if you cannot make it to the University on time. But if you do submit electronically:

Make sure to put your name in all electronically submitted files (even if you submit your file by email).

Make sure text file you submit can be printed out and it comes out properly.

Use a format that is well known and easy to open/read (just text format would do it).

Page 8: CS 330 Algorithms: Lecture 1

No late assignments will be accepted. (Homework Box): If you come to CS building earlier, try

submit the hws to the submission box up until 10:45am. I will be taking the hw's out from the submission box shortly after that time on my way to the class. If you do not make it to the box before 10:45am, bring the hw to the class.

(Classroom) I will also accept the hw's up until the class start.

I will stop accepting the hw's when the class starts. If you cannot make it to the class on time, please make

sure to submit the hw ahead of time. The late penalty will be exponential in the minutes it is

late (2^m-1, where m is the number of minutes you are late - that's one way to learn about the perils of exponential growth ). The reason the penalty is so steep is that I want to discourage you from finishing at the last minute and coming late to class as the result.

Page 9: CS 330 Algorithms: Lecture 1

Comments from the grader:

The main issue is readability, so for example, if you need to draw something, it is better to do it by hand, than to mess with text formatting of drawing pictures in text files. Please, be sure that if you are hand-writing a hw, then your hand-writing is perfectly clear.

Page 10: CS 330 Algorithms: Lecture 1

Policy Regrading Policy:

1. If you submit the wrong file or a file with the wrong filename, this includes submission of an empty directory, submission of an executable, etc., then 50% will be taken off from your original grade. Note: In such cases you will be required to show a proof that your source file has a last modification date prior to the submission deadline. Note: attempts to cheat on this will be reported. See Academic Conduct.

Page 11: CS 330 Algorithms: Lecture 1

Policy If you ask to re-grade your homework please

write out the basis of your request. If the grader finds no basis for your complaint,

then 10 points will be taken off your original grade unless the grade is changed.

Note: This is not to say that we discourage you from disputing your grade, but rather we encourage you to read and understand the comments of the grader before complaining.

Page 12: CS 330 Algorithms: Lecture 1

Policy Under no circumstances should you be

copying or using the work of others.It is fine to discuss problems (in general terms) with others, but the specifics of a solution and all of the writing should be done without any collaboration. (See also Academic Conduct)

Page 13: CS 330 Algorithms: Lecture 1

Algorithms in the “Real World”

How much impact modern algorithms has had on the Web and Internet today? String matching Indexing and Searching

Sorting and selection Information clustering Search trees Matrix computations: eigenvalues and linear

systems

Page 14: CS 330 Algorithms: Lecture 1

Algorithms in the “Real World” How much impact modern algorithms has had on the Web and

Internet today? Internet Algorithms:

Networking routing • Shortest path• Congestion control

Multicasting Caching Streaming algorithms and video on demand

Encryption, decryption, and password hashing Public key cryptography, RSA, testing primes, multiplication of large

numbers Random number generation

Authentication

Page 15: CS 330 Algorithms: Lecture 1

Algorithms in the “Real World”

How much impact modern algorithms has had on the Web and Internet today? Error correction, coding and decoding

Various error-detection and correction code Data compression

Huffman codes, Lempel-Ziv code Image, Audio, Video compression

Vector quantization JPEG and MPEG Fractal coding

Page 16: CS 330 Algorithms: Lecture 1

Algorithms in the “Real World”

How much impact modern algorithms has had on the Web and Internet today? Network Design and Optimization

Minimum-spanning tree Nearest neighbors Graph matching and maximum flow Network connectivity

Mathematical Optimization Linear Programming Integer Programming

Page 17: CS 330 Algorithms: Lecture 1

Algorithms in the “Real World”

Other Application Computational Biology

String alignment DNA sequencing

Scientific Simulation Particle simulation (N-body simulation) Linear system Ax = b Eigenvalue Problem Ax = x Triangulation and Finite Element method

VLSI circuit design Various graph algorithm Finite state machines

Page 18: CS 330 Algorithms: Lecture 1

Sorting: getting organized

Input:     Array A[1...n], of elements in

arbitrary order; array size nOutput:  Array A[1...n] of the same elements, but in the non-decreasing order

Given name find telephone number Given telephone number find name

Page 19: CS 330 Algorithms: Lecture 1

Binary Search Input:  Array A[1...n] of the elements in the

non-decreasing order, and an element k Output:  if k in A[1..n] then output j such that

A[j] = k, otherwise, output 0

Algorithm: s = 1; e = n; while s < e { m = floor( (s+e)/2 ); if k <= A[m] then e = m else s = m } if A[s] = k then j = s else j = 0

Page 20: CS 330 Algorithms: Lecture 1

Binary Search (II) Input:  Array A[1...n] of the elements in the

non-decreasing order, and an element k Output:  if k in A[1..n] then output j such that

A[j] = k, otherwise, output 0

Algorithm: s = 1; e = n; found = 0; while (s < e and found = 0) { m = floor( (s+e)/2 ); if k = A[m] then j = m; found = 1; else if k < A[m] then e = m-1 else s = m+1 } if found = 0 then j = 0

Page 21: CS 330 Algorithms: Lecture 1

Complexity of binary search

Input size

Number of comparisons