Crèdits
6
Tipus
Obligatòria
Requisits
Aquesta assignatura no té requisits
, però té capacitats prèvies
Departament
CS
Web
http://www.cs.upc.edu/~ap1
Mail
ap1@cs.upc.edu
El curs cobreix conceptes i tècniques bàsiques per construir programes en llenguatges imperatius.
1. coneixerà els components bàsics dels llenguatges imperatius: variables, tipus, expressions, condicionals i iteracions.
2. serà capaç d'utilitzar i dissenyar procediments (accions i funcions) per encapsular solucions de subproblemes.
3. serà capaç d'utilitzar la metodologia del disseny descendent per donar solucions a problemes de dificultat mitjana.
4. serà capaç d'utilitzar vectors i diccionaris per emmagatzemar informació estructurada i com a base per al disseny d'estructures de dades.
5. Coneixerà i sabrà reproduir i utilitzar correctament alguns algorismes fonamentals, com ara la cerca dicotòmica o els algorismes elementals d'ordenació vectorial.
El llenguatge de programació utilitzat en aquest curs és Python, encara que l'èmfasi no està en l'aprenentatge dels detalls del llenguatge sinó en la resolució de problemes algorísmics i la construcció de programes estructurats.
Professorat
Responsable
- Lluis Padro Cirera ( padro@cs.upc.edu )
Hores setmanals
Teoria
2
Problemes
2
Laboratori
0
Aprenentatge dirigit
0
Aprenentatge autònom
6
Competències
Coneixements
Habilitats
Competències
Objectius
-
Entendre com construir un programa i utilitzar les eines les eines necessàries: consola, editor i compilador.
Competències relacionades: K4, C6, -
Comprendre la sintaxi i la semàntica d'expressions i instruccions bàsiques en un llenguatge de programació imperatiu (Python).
Competències relacionades: K4, C6, -
Comprendre els conceptes de funció, procediment i pas de paràmetres, per poder-ho
utilitzar funcions i procediments per desenvolupar programes.
Competències relacionades: K4, C6, -
Comprendre llistes, diccionaris i conjunts, i identificar com utilitzar-los adequadament per resoldre problemes
Competències relacionades: K3, K4, S7, C6, -
Comparar solucions pel que fa a l'ús del temps i de la memòria i triar les solucions més adequades per a casos senzills.
Competències relacionades: K3, S7, S8, C6, -
Comprendre esquemes de cerca i recorregut i aplicar-los adequadament per resoldre problemes.
Competències relacionades: K3, S7, C6, -
Entendre la cerca binària i els algorismes d'ordenació bàsics (inserció, selecció, bombolla, mergesort)
Competències relacionades: K3, S8, C6,
Continguts
-
Basic Programming concepts
Introduction: algorithm, program
- variable, expression,
- assignment. I/O. Conditional
- Iiterative statements.
Solving problems with scalar data -
Iterative schemas
Traversal & Search schemas.
Invariants -
Functions and Procedures
Function design and parameter passing.
Function design examples. -
Lists
Representation of data structures with lists. Traversal and search algorithms on lists. Python memory management of Lists -
Matrices
Basic algorithms on matrices: sum, symmetric, transpose, multiplication.
Python memory management of Matrices -
Dictionaries
Memory representation of dictionaries. Hashing concept.
Mutability. Tuples.
Counters. Sets.
FrozenSets -
Computational Complexity
Basic notions of computational complexity -
Sort algorithms
Bubble sort
Insertion sort
Selection sort
Mergesort
sorting Python structures using lambda as key -
Standard Python Input
readline
readlines
strip
split
Activitats
Activitat Acte avaluatiu
Functions.
Functions: design and parameter passing. Function design examples.Objectius: 3
Continguts:
Teoria
4h
Problemes
4h
Laboratori
0h
Aprenentatge dirigit
0h
Aprenentatge autònom
12h
Lists and Matrices
Representation of data structures with lists. Traversal and search algorithms on lists. Python memory management of Lists Matrices. Basic algorithms on matrices: sum, symmetric, transpose, multiplication. Python memory management of MatricesObjectius: 4
Continguts:
Teoria
4h
Problemes
4h
Laboratori
0h
Aprenentatge dirigit
0h
Aprenentatge autònom
12h
Sort algorithms
Bubble sort Insertion sort Selection sort sorting Python structures. Using lambda as keyObjectius: 7
Continguts:
Teoria
4h
Problemes
4h
Laboratori
0h
Aprenentatge dirigit
0h
Aprenentatge autònom
12h
Data Structure Design
Representing complex data. lists of lists, lists of dictionaries, dictionaries with lists, embedded dictionaries. dicctionaries with structured keys (tuples/frozensets) Problem solving via appropriate data structuresObjectius: 4 5
Continguts:
Teoria
4h
Problemes
4h
Laboratori
0h
Aprenentatge dirigit
0h
Aprenentatge autònom
12h
Metodologia docent
During theoretical sessions, the professor will expose programming concepts, combined with examples and problem solving.During problem-solving sessions, students will work on their own solving problems with an online platform (El Jutge), under supervison and assistance of the professor when needed
Mètode d'avaluació
hi haura dos examens. Un parcial i un finalAddicionalment, hi haura algunes proves evaluables realitzades durant les classes de problemes, anunciades amb antelacio.
NotaFinal = 0.10*NP + 0.90*max(EF, 0.4*EP+0.6*EF)
on:
NP : Nota de problemes. Testos curts realitzas a les classes de problemes
EP: Examen parcial
EF: Examen final
Es podran presentar a reevaluacio els estudiants que no hagin superat el curs.
La reevaluació consistirà en un exàmen adiccional, la nota del qual substituirà la de EF.
Bibliografia
Bàsic
-
Introduction to Computation and Programming Using Python
- Guttag, John V,
The MIT Press,
2021.
ISBN: 9780262542364
https://research-ebsco-com.recursos.biblioteca.upc.edu/c/ik5pvi/search/details/mlj5v5o4zf?db=nlebk
Complementari
-
Introduction to Algorithms
- Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein Clifford,
The MIT Press,
2022.
ISBN: 0262367505
https://research-ebsco-com.recursos.biblioteca.upc.edu/c/ik5pvi/search/details/lq2sgumirf?db=nlebk
Web links
- Think Python (O'Reilly 2012) http://greenteapress.com/thinkpython/html/index.html
- Linux command line tutorial http://linuxcommand.org/index.php
- Jutge.org https://jutge.org
- Python Tutor https://pythontutor.com/python-compiler.html
- Selection of online Python books and tutorials for beginners https://wiki.python.org/moin/BeginnersGuide/NonProgrammers