Computer science

A.Y. 2020/2021
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.. The object oriented paradigm is overviewed.
Expected learning outcomes
The student will be able to:

1) Approach problems tipically 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) Properly use objects from suitable libraries to provide graphic representation of output data.
4) Manage an operating system to code, compile, link and execute programs.
Course syllabus and organization

CORSO A

Responsible
Lesson period
First semester
Instructions for lecturing amid pandemics will be immediately posted on the websites dedicated to the course (see url's below).

in case of online lecturing, lectures will be provided via Zoom either syncronously and recorded for an asyncronous attendance. The contents of the course as well as the resources for preparing the final exam will not modify. The final exam will take place via Zoom according to modality and criterions adopted for the traditional exam, described below.
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++
- The RooT library for graphic representation of data, using objects in C++
- Main classes in RooT: scatterPlot, histograms, functions, canvas
- Software design for data analysis and graphic representation by RooT
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:
- ARIEL https://cmereghettii.ariel.ctu.unimi.it/v5/home/Default.aspx
- GENERAL http://www.l30-informatica.fisica.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: Mereghetti Carlo

CORSO B

Responsible
Lesson period
First semester
Theory lessons: held remotely via Zoom platform.
Laboratorio: held remotely (Zoom and repl.it platforms to be confirmed).
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 ++
12. Use of the RooT library for graphical data processing, hints on the use of objects in C ++
13. The main classes of RooT: scatterPlot, histograms, functions, windows
14. Development of analysis projects and final visualization of data through RooT
Prerequisites for admission
None
Teaching methods
Theory lessons:
2 hours per week.
Lab:
-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++
- The ROOT library for graphic representation of data, using objects in C++
- Main classes in ROOT: scatterPlot, histograms, functions, canvas
- Software design for data analysis and graphic representation by ROOT
Prerequisites for admission
No particular prerequisite required.
Teaching methods
Lectures: Remote lectures using Zoom.
Laboratory: Remove lectures using Zoom.
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.
Entrambi i testi sono disponibili anche in inglese.

Websites:
- General: http://www.l30-informatica.fisica.unimi.it/
- Personal (exams results): http://cern.ch/stefano.carrazza
- Lab: https://github.com/scarrazza/informatica2020
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. A/5/C13, Ed. LITA, V floor, Dipartimento di Fisica "Aldo Pontremoli"
Reception:
Monday, 2 pm - 3 pm (or on appointment)
Room C12, 5th floor LITA Building, Physics Department, via Celoria 16 (during COVID-19 emergency: remotely via Zoom)