algorithmics and programming ii:...

15
Algorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of Computer Science

Upload: others

Post on 26-May-2020

27 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Algorithmics and Programming II:Introduction

Jordi Cortadella and Jordi Petit

Department of Computer Science

Page 2: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Algorithmics and Programming II

• Lecturers:

– Jordi Cortadella ([email protected])

– Jordi Petit ([email protected])

• Sessions:

– Theory & Problems (Jordi C.)

– Lab (Jordi P. & Jordi C.)

Introduction © Dept. CS, UPC 2

Page 3: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Material

• Slides, exercises:

https://www.cs.upc.edu/~jordicf/Teaching/AP2

• Jutge (for lab sessions):

https://jutge.org

• Lliçons (by J. Petit and S. Roura):

https://lliçons.jutge.org

Introduction © Dept. CS, UPC 3

Page 4: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Introduction © Dept. CS, UPC 4

Page 5: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Evaluation

• Evaluation items:

– Project (Proj), Parcial Lab (PLab),Final Theory (FTh), Final (FLab).

• Grading:– 𝑁1 = 𝟎. 𝟐 Proj + 𝟎. 𝟐𝟓 PLab + 𝟎. 𝟐𝟓 FLab + 𝟎. 𝟑 FTh

– 𝑁2 = 𝟎. 𝟐 Proj + 𝟎. 𝟒 FLab + 𝟎. 𝟒 FTh

– 𝑁 = max(𝑁1, 𝑁2)

Introduction © Dept. CS, UPC 5

Page 6: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

First project: Skyline

• Design a class and a small calculator to operate with rectilinear skylines.

• Language: python.

Introduction © Dept. CS, UPC 6

Page 7: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Peer and self assessment• The project will be evaluated by the students

themselves.

• Each project will be evaluated by three students. The grade will be calculated as the average grade given by the students.

• The evaluation will be completely blind.

• Biased evaluations will be detected and penalized.

• Each student will have the right to request the evaluation by the professor (who can upgrade or downgrade the evaluation given by the students).

Introduction © Dept. CS, UPC 7

Page 8: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Street map represented as a graph

Second Project: GPS

Introduction © Dept. CS, UPC 8

Language: python

Page 9: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Objective of the course

Confronting large and difficult problems. How?

Skills for abstraction and algorithmic reasoning.

Design and use of complex data structures.

Techniques for complexity analysis.

Methodologies for modular programming.

High-quality code.

Introduction © Dept. CS, UPC 9

Page 10: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Problems on polygons

Introduction © Dept. CS, UPC 10

Compute the convex hull of 𝑛 given points in the plane.

Page 11: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

The Closest-Points problem

• Input: A list of 𝑛 points in the plane𝑥1, 𝑦1 , 𝑥2, 𝑦2 , … , 𝑥𝑛, 𝑦𝑛

• Output: The pair of closest points

• Simple approach: check all pairs O(𝑛2)

• We want an O(𝑛 log 𝑛) solution !

Introduction © Dept. CS, UPC 11

Page 12: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Navigation: find the shortest path

Introduction © Dept. CS, UPC 12

Page 13: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

How to encrypt messages?

Introduction © Dept. CS, UPC 13

Page 14: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Introduction © Dept. CS, UPC 14

Page 15: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of

Introduction © Dept. CS, UPC 15