Computer Science

A.Y. 2024/2025
6
Max ECTS
60
Overall hours
SSD
INF/01
Language
Italian
Learning objectives
The course aims at introducing basics of Computer Science, with a particular emphasis on Programming. Basic concepts on the digital representation of information and on computer architetture are outlined. The notions of algorithm and program are presented, as long as main tools involved in software design. Structured programming and the imperative paradigm are settled, focusing on modular software design. Some relevant data strutture and algorithms are presente, addressing the evaluation of algorithmic time complexity.
Expected learning outcomes
The student will be able to:
1) Approach problems typically dealing with data analysis, and conceptually design solution algorithms.
2) Code modular algorithms by choosing appropriate data structure and constructions offered by the selected programming language.
3) Manage an operating system to code, compile, link and execute programs.
Single course

This course cannot be attended as a single course. Please check our list of single courses to find the ones available for enrolment.

Course syllabus and organization

CORSO A

Responsible
Lesson period
First semester
Course syllabus
Theory Lectures Syllabus
- What Computer Science is: physical and theoretical means for information processing
- The notion of algorithm, examples: Euclid's algorithm, simple arithmetical algorithms
- From algorithms to programs: executors and programming languages
- The information and its numerical representation (texts, sound, images), digital information
- Number systems in different bases, octal, hexadecimal and binary (digital) bases
- Binary representation of numbers
- Negative numbers representation: signed and two's complement
- Floating point representation of rationals, mantissa, exponent, roundoff errors
- Measuring information: bit, byte, multiples
- Computer architecture, Von Neumann's machine
- CPU, RAM, BUS, peripherals, main features and functions
- Machine language and assembly, low-level programming, drawbacks
- High-level programming, languages and compilers
- Software Lifecycle: design, compiling, linking, loading, running
- Possible errors and debugging
- Structured programming and Boehm-Jacopini's Theorem. Control structures
- Forms of selection, examples
- Variables, types and operations
- Forms of iterations, examples: managing data streams and testing arithmetical properties
- The first C++ program. cout output stream
- C++ types, main features and operations. int, float, char, bool
- Variable declaration, variable setting by expressions and input operations. cin stream
- string type. C-strings, structure, use and main operations
- Control structures in C++. Selection, variants, nested if
- bool type for conditions, main features and boolean operators. The conditional operator
- Iteration in C++, variants. for loop. break statement
- Monodimensional arrays in C++. Main features and operations on arrays
- Arrays and memory allocation, array starting address. Bidimensional arrays, examples
- The notion of a struct
- File handling in C++. Main features of fstream library. Opening, using and closing file streams
- Output manipulation, iomanip library
- Dynamic arrays, features, definition and usage. Data loading from files to dynamic arrays
- Functions in C++. Top-down program design. Structure of functions returning values and void
- Argument passing, by value and reference, meaning. Software modularization and signatures
- Memory managing, activation record, stack, heap, stack overflow
- C++ recursive functions, inductive definition of functions and their implementation by recursion
- Stack dynamics along recursion. Iteration vs. recursion performance
- Introduction to worst-case time complexity of algorithms
- Searching arrays. Linear and binary search, implementations and time complexity analysis
- Sorting, time lower boundz. Selection sort, implementation and quadratic time complexity
- Mergesort, design and implementation
- Time complexity evaluation of mergesort by recurrence equation, optimal time
- Pointers, meaning, definition and usage. Pointing struct and objects
- Dynamic variables and pointers, dynamic arrays, new statement. Memory leak and delete statement
- Pointers operations, pointers arithmetics. Using pointers for array scanning, shallow and deep array copy
- Traditional arrays and constant pointers, differences with dynamic arrays. Functions returning arrays, arrays setting on stack and heap
- main arguments, line command arguments. Implementing simple commands in operating systems

Lab Lectures Syllabus
- Operating systems, Linux and the file system
- Using the Linux shell, main commands
- Programming environments, editor, compilers
- First C++ programs
- Selection and iteration in C++
- Array and struct
- Functions in C++ and argument passing
- Design of library of functions. Library implementation, file header
- Object files creation e their linking
- make command and structure of a makefile
- Using files in C++
- Software design for data analysis and their presentation
Prerequisites for admission
None.
Teaching methods
The course consists of traditional theory lectures and lab lectures:

- Traditional theory lectures present basics of programming and algorithm design. A programming language is introduced, explaining syntax, semantics and reviewing programming techniques and relevant algorithms. During these lectures, exercises and problems are proposed and discussed, encouraging cooperation and team work, and discussing different proposed solutions.

- Lab lectures first of all aims at presenting basic features of an operating systems as well as typical programming tools (editors, compilers, ...). During these lectures, programming exercises and projects of increasing complexity are proposed. Actual software implementations of such projects are discussed and made available on the course website.
Teaching Resources
Textbooks:
- D.S. Malik: Introduction to C++ Programming. Cengage South-Western, 2009.
- L.J. Aguilar: Fondamenti di programmazione in C++. Algoritmi, strutture dati e oggetti. McGraw-Hill, 2008.

Websites:
- myAriel https://myariel.unimi.it/course/view.php?id=2879
Assessment methods and Criteria
The exam consists of a written exam plus a lab exam:

- In the written exam, some programming exercises are proposed, particularly aiming at checking the knowledge of the theoretical bases of programming and the ability of designing simple algorithms. The time allowed for the written exam is two hours, during which students are not enabled to consult any reference. In the evaluation of this written exam, rating from 1 to 30, both the ability of conceptually projecting algorithms and the correctness of the formal specification of such algorithms in the chosen programming language is taken under consideration.

- In the lab exam, a data analysis project of a certain complexity is proposed, for which the production of working and well structured software is required. The time allowed for the lab exam is about three hours, during which students are enabled to use their software developed during lab lectures. In the evaluation of this lab exam, rating from 1 to 30, the ability of projecting algorithms as well as producing modular, well structured and maintainable code is taken under consideration.

The final evaluation, rating from 1 to 30, earned by the student for this course originates by suitably averaging the evaluation of both the written and the lab exam. An evaluation between 18 and 23 indicates an appropriate level of knowledge of theoretical and practical basics of computer science and programming, an evaluation between 24 and 27 indicates a good knowledge of such basics, higher evaluations indicate a very good knowledge and originality in applying basics in computer science and programming.
INF/01 - INFORMATICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
Professor: Mereghetti Carlo

CORSO B

Responsible
Lesson period
First semester
In the case of remote teaching, lectures will be delivered via Zoom synchronously and simultaneously recorded for possible asynchronous use. The teaching program and resources for exam preparation will not change. The exam will be delivered via Zoom according to the form and criteria adopted for the in-person exam and given below.
Course syllabus
Theory lectures program:

1. What is Informatics: hardware and theoretical means for information processing.
. 2. Algorithm: definition, examples: Euclid and simple numerical algorithms.
3. From algorithms to programs: executors and programming languages.
4. Numerical information representation (of text, sound, pictures): information digitalization.
5. Binary and exadecimal representation (digitalization).
6. Binary representation of integers.
7. Overflow.
8. Floating point representation: significand, exponent.
9. Measure of information: bit, byte, words, multiples.
10. Computer architecture: von Neumann machine.
11. CPU, RAM, BUS, main devices.
12. Machine language and assembly, low level programming, disadvantages
13. High level programming, languages ​​and compilers
14. Software life cycle: design, compilation, linking, loading, execution. Possible errors and debugging
15. Structured programming and Boehm-Jacopini theorem. The control structures
16. Selection forms, examples
17. Variables, types and operations
18. Forms of iteration, examples: management of data streams and numerical tests
19. The first C ++ program. The output cout stream
20. The types in C ++, main features and operations. Integer types, floating point types, characters and bool
21. Variable declarations, asssignment through expressions and input operations. The stream cin
22. The string type. C-strings, their structure, management and main functions
23. The control structures in C ++. Selection, various forms and nested if
24. The bool type for conditions, main characteristics and Boolean operators. The conditional operator.
25. Iteration in C ++, possible forms. The for loop. The break statement
26. One-dimensional arrays in C ++, main features, functionality and operations on arrays
27. Array and memory allocation, array start address. Two-dimensional arrays, examples
28. The concept of struct
29. File management in C ++. Main features of the fstream library. Opening, manipulation and closing of streams on file
30. Output manipulators, the iomanip library
31. Dynamic arrays, characteristics, definition and use. Loading data from files to dynamic arrays
32. Functions in C ++. Modular top-down program development. Form of a function that returns values ​​and voids
33. Passing of parameters, by value and reference, meaning. Modular shape of the source and prototypes
34. Memory management, activation records, stacks, heaps, stack overflow errors
35. Recursive C ++ functions, inductive definitions of functions, their implementation through recursion
36. Stack dynamics during recursion. Iterative vs. performance recursive
37. Notes on the worst case complexity of the algorithms
38. Search in an array. Linear and binary solution, implementations and performance analysis
39. The sorting problem, lower limits to complexity in time. Selection sort, implementation and complexity in quadratic time
40. Mergesort, specification and implication.Evaluation of complexity in time of mergesort by recurrence equation, optimal time
41. The pointers, meaning, definition and use. Pointers to structures and objects
42. Dynamic variables and pointers, dynamic arrays, new statement. Memory leak and delete statement
43. Pointer operations, pointer arithmetic. Using pointers to scroll through arrays, shallow and deep copy of arrays
44. Traditional arrays as constant pointers, difference with dynamic arrays. Arrays returned by functions, arrays on stacks and on heaps
45. The main parameters, command line acquisition. Implementations of simple operating system commands


Program of laboratory exercises

1. Operating systems, Linux and the file system
2. The use of the Linux terminal, main commands
3. The programming environment, editors, compilers
4. First programs in C ++
5. Selection and cycles in C ++
6. Array and struct
7. C ++ functions and passing of parameters
8. Creation of function libraries. Implementation of libraries, header files.
9. Object file creation and linking
10. Using the make command and structure of a makefile
11. Use of files in C ++: data formatting.
Prerequisites for admission
None
Teaching methods
Theory lessons: 2 hours per week.
-Introduction of formal concepts, discussion of algorithms, semantics of the language constructs.

Lab: 3 hours per week.
-introduction and demonstration of new language constructs, discussion and correction of assigned exercises, individual work on assigned exercises.
Teaching Resources
D.S. Malik: Introduction to C++ Programming. Course Technology, 2009.

L.J. Aguilar: Fondamenti di programmazione in C++. Algoritmi, strutture dati e oggetti. McGraw-Hill, 2008.
Assessment methods and Criteria
The exam consists of a written test and a laboratory test. Each test is evaluated independently and in the case of a positive evaluation (greater than or equal to 18) of both tests, the two marks contribute to forming the final mark, given by the arithmetic average of the two marks, rounded up to the next integer.

The written test takes place without the use of texts and /or notes and focuses on the fundamental conceptual rules of C ++ and on the development of the simple algorithms.

The laboratory test involves the development of C ++ algorithms relating to topics explicitly covered in the course and /or in the courses carried out in parallel (analysis, mechanics and statistics), during the test the student can consult bibliographic material and personal folder which he completed during the laboratory sessions (and completed independently).
INF/01 - INFORMATICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
Professor: Tamascelli Dario

CORSO C

Responsible
Lesson period
First semester
Course syllabus
Theory Lectures Syllabus
- What Computer Science is: physical and theoretical means for information processing
- The notion of algorithm, examples: Euclid's algorithm, simple arithmetical algorithms
- From algorithms to programs: executors and programming languages
- The information and its numerical representation (texts, sound, images), digital information
- Number systems in different bases, octal, hexadecimal and binary (digital) bases
- Binary representation of numbers
- Negative numbers representation: signed and two's complement
- Floating point representation of rationals, mantissa, exponent, roundoff errors
- Measuring information: bit, byte, multiples
- Computer architecture, Von Neumann's machine
- CPU, RAM, BUS, peripherals, main features and functions
- Machine language and assembly, low-level programming, drawbacks
- High-level programming, languages and compilers
- Software Lifecycle: design, compiling, linking, loading, running
- Possible errors and debugging
- Structured programming and Boehm-Jacopini's Theorem. Control structures
- Forms of selection, examples
- Variables, types and operations
- Forms of iterations, examples: managing data streams and testing arithmetical properties
- The first C++ program. cout output stream
- C++ types, main features and operations. int, float, char, bool
- Variable declaration, variable setting by expressions and input operations. cin stream
- string type. C-strings, structure, use and main operations
- Control structures in C++. Selection, variants, nested if
- bool type for conditions, main features and boolean operators. The conditional operator
- Iteration in C++, variants. for loop. break statement
- Monodimensional arrays in C++. Main features and operations on arrays
- Arrays and memory allocation, array starting address. Bidimensional arrays, examples
- The notion of a struct
- File handling in C++. Main features of fstream library. Opening, using and closing file streams
- Output manipulation, iomanip library
- Dynamic arrays, features, definition and usage. Data loading from files to dynamic arrays
- Functions in C++. Top-down program design. Structure of functions returning values and void
- Argument passing, by value and reference, meaning. Software modularization and signatures
- Memory managing, activation record, stack, heap, stack overflow
- C++ recursive functions, inductive definition of functions and their implementation by recursion
- Stack dynamics along recursion. Iteration vs. recursion performance
- Introduction to worst-case time complexity of algorithms
- Searching arrays. Linear and binary search, implementations and time complexity analysis
- Sorting, time lower boundz. Selection sort, implementation and quadratic time complexity
- Mergesort, design and implementation
- Time complexity evaluation of mergesort by recurrence equation, optimal time
- Pointers, meaning, definition and usage. Pointing struct and objects
- Dynamic variables and pointers, dynamic arrays, new statement. Memory leak and delete statement
- Pointers operations, pointers arithmetics. Using pointers for array scanning, shallow and deep array copy
- Traditional arrays and constant pointers, differences with dynamic arrays. Functions returning arrays, arrays setting on stack and heap
- main arguments, line command arguments. Implementing simple commands in operating systems

Lab Lectures Syllabus
- Operating systems, Linux and the file system
- Using the Linux shell, main commands
- Programming environments, editor, compilers
- First C++ programs
- Selection and iteration in C++
- Array and struct
- Functions in C++ and argument passing
- Design of library of functions. Library implementation, file header
- Object files creation e their linking
- make command and structure of a makefile
- Using files in C++
Prerequisites for admission
No particular prerequisite required.
Teaching methods
Lectures: frontal lectures.
Laboratory: lectures in the computational laboratory.
Teaching Resources
Textbooks:
- D.S. Malik: Programmazione in C++. Apogeo, 2013.
- L.J. Aguilar: Fondamenti di programmazione in C++. Algoritmi, strutture dati e oggetti. McGraw-Hill, 2008.

Websites:
- Ariel: https://myariel.unimi.it/
Assessment methods and Criteria
The exam consists of a written exam plus a lab exam:

- In the written exam, some programming exercises are proposed, particularly aiming at checking the knowledge of the theoretical bases of programming and the ability of designing simple algorithms. The time allowed for the written exam is two hours, during which students are not enabled to consult any reference. In the evaluation of this written exam, rating from 1 to 30, both the ability of conceptually projecting algorithms and the correctness of the formal specification of such algorithms in the chosen programming language is taken under consideration.

- In the lab exam, a data analysis project of a certain complexity is proposed, for which the production of working and well structured software is required. The time allowed for the lab exam is about three hours, during which students are enabled to use their software developed during lab lectures. In the evaluation of this lab exam, rating from 1 to 30, the ability of projecting algorithms as well as producing modular, well structured and maintainable code is taken under consideration.

The final evaluation, rating from 1 to 30, earned by the student for this course originates by suitably averaging the evaluation of both the written and the lab exam.
INF/01 - INFORMATICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
Professor: Carrazza Stefano
Educational website(s)
Professor(s)
Reception:
On appointment, via email
Uff. S 6008, VI floor, Dip. Informatica "Giovanni Degli Antoni", via Celoria 18, 20133 Milano, Italy
Reception:
By appointment, send e-mail
Room C12, 5th floor LITA Building, Physics Department, via Celoria 16.