Credits
6
Types
Compulsory
Requirements
This subject has not requirements
, but it has got previous capacities
Department
CS
Web
http://www.cs.upc.edu/~ap1
Mail
ap1@cs.upc.edu
The course covers basic concepts and techniques for building programs in imperative languages.
1. will know the basic constituents of imperative languages: variables, types, expressions, conditionals and iterations.
2. will be able to use and design procedures (actions and functions) to encapsulate sub-problem solutions.
3. will be able to use the descending design methodology to give solutions to problems of medium difficulty.
4. will be able to use vectors and dictionaries to store structured information and as a basis for the design of data structures.
5. will know and be able to reproduce and properly use some fundamental algorithms, such as dichotomous search or elementary vector sorting algorithms.
The programming language used in this couse is Python, although the emphasis is not on learning the details of the language but on solving algorithmic problems and building structured programs.
Teachers
Person in charge
- Lluis Padro Cirera ( padro@cs.upc.edu )
Weekly hours
Theory
2
Problems
2
Laboratory
0
Guided learning
0
Autonomous learning
6
Competences
Knowledge
Skills
Competences
Objectives
-
Understand how to build a program and use tools the necessary tools: console, editor and compiler.
Related competences: K4, C6, -
Understand the syntax and semantics of basic expressions and instructions in an imperative programming language (Python).
Related competences: K4, C6, -
Understand the concepts of function, procedure and parameter passing, to be able to
use functions and procedures to develop programs.
Related competences: K4, C6, -
Understand lists, dictionaries, and sets, and identify how to use the appropriately to solve problems
Related competences: K3, K4, S7, C6, -
Compare solutions regarding time and memory use and choose the most appropriate solutions for simple cases.
Related competences: K3, S7, S8, C6, -
Understand search and traversal schemas and appropriately apply them to solve problems.
Related competences: K3, S7, C6, -
Understand binary search, and basic sort algorithms (insertion, selection, bubblesort, mergesort)
Related competences: K3, S8, C6,
Contents
-
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
Activities
Activity Evaluation act
Functions.
Functions: design and parameter passing. Function design examples.Objectives: 3
Contents:
Theory
4h
Problems
4h
Laboratory
0h
Guided learning
0h
Autonomous learning
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 MatricesObjectives: 4
Contents:
Theory
4h
Problems
4h
Laboratory
0h
Guided learning
0h
Autonomous learning
12h
Sort algorithms
Bubble sort Insertion sort Selection sort sorting Python structures. Using lambda as keyObjectives: 7
Contents:
Theory
4h
Problems
4h
Laboratory
0h
Guided learning
0h
Autonomous learning
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 structuresObjectives: 4 5
Contents:
Theory
4h
Problems
4h
Laboratory
0h
Guided learning
0h
Autonomous learning
12h
Teaching methodology
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
Evaluation methodology
There will be two exams. A mid-term exam and a final examIn addition, there will be some evaluable problem tests taken during problem sessions, announced in advance.
FinalScore = 0.10*NP + 0.90*max(EF, 0.4*EP+0.6*EF)
where:
NP : Problem score. Short problem tests taken during problem sessions
EP: Partial exam score
EF: Final exam score
Students failing the course may opt to reevaluation.
Reevaluation will consist of an additional exam, the grade of which will replace EF score.
Bibliography
Basic
-
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
Complementary
-
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