Algorithmics and Programming II:...
Transcript of Algorithmics and Programming II:...
![Page 1: Algorithmics and Programming II: Introductionjordicf/Teaching/AP2/pdf/01_Introduction.pdfAlgorithmics and Programming II: Introduction Jordi Cortadella and Jordi Petit Department of](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/1.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/2.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/3.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/4.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/5.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/6.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/7.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/8.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/9.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/10.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/11.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/12.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/13.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/14.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022041021/5ed0bda021598f4d1d04ae92/html5/thumbnails/15.jpg)
Introduction © Dept. CS, UPC 15