|Politecnico di Torino|
|Academic Year 2017/18|
Algorithms and Programming
1st degree and Bachelor-level of the Bologna process in Computer Engineering - Torino
The course allows the student to acquire adequate knowledge and skills in algorithms, data structures and their implementation in C to solve complex problems. The student should gradually evolve from more analytic to more design-oriented skills. Algorithmic solutions to "classical" problems are introduced, together with their theoretical foundations, and the implementations in C language. Advanced aspects of C are considered, like pointers, dynamic memory allocation, modularity and Abstract Data Type implementation. The student has the opportunity to analyze practical examples, describing solutions to complex problems, and the related algorithmic paradigms. Knowledge and programming skills are applied during lab sessions.
Expected learning outcomes
• Knowledge of techniques for memory allocation and use of pointers.
• Programming skills in C language, using pointers and dynamic data structures.
• Knowledge of basic complexity analysis.
• Knowledge of sorting algorithms.
• Ability to evaluate algorithm complexity and improve efficiency in terms of execution time and/or memory use.
• Knowledge of complex data structures and ADTs (linked lists, queues, stacks, heaps, trees, hash tables and graphs) and related algorithms.
• Knowledge of simple strategies for modular programming in C.
• Knowledge of recursive and greedy problem-solving paradigms.
• Skills in problem solving, based on design of data structures and algorithms.
• Skills in recursive programming techniques.
• Skills to exploit tools for program development.
Prerequisites / Assumed knowledge
Due to the incremental nature of the course with respect to the first year class "Computer Science", there are several strict prerequisites in terms of programming skills and programming language knowledge, with particular emphasis on the following topics:
• Elementary computer systems architecture (Von Neumann model).
• Syntax of C, basic data types and constructs.
• Basic programming skills in C, using conditional and iterative constructs, scalar and aggregate data, standard I/O, text files and functions.
• Skills in elementary (algorithmic) problem solving.
• Review of basic language construct and basic problem solving (12h)
• Algorithm analysis (3h)
o Asymptotic worst-case complexity analysis
o O, , notations
o Recurrence equations
• Sorting algorithms (6h)
o Iterative sorting (bubble sort, selection sort, insertion sort, shell sort, counting sort)
o Recursive sorting (mergesort, quicksort, heapsort)
• Static and dynamic data structures and their implementation in C (13h)
o Data representation in memory and runtime memory management
o Pointers (or references to objects)
o Static, on stack and dynamic memory allocation
o Linked structures
o Strategies for data structure selection
• Modularity and modular implementation of algorithms and data structures (10h)
o The implementation-interface-client model
o Implementation in C of programs with multiple source and header files
o Basic use of development and debug tools, like make, gdb, cvs
• Recursion and recursive programs (10h)
o The notion of recursion
o Mathematical recursive functions
o Simple recursive procedures
o Backtrack and implementation of recursion
• Discrete mathematics (2h)
o Sets, relations, functions
o Lists, graphs and trees
• Abstract objects, collections of objects and ADTs (8h)
o Modular examples of composed structures, like arrays of lists and multilists
o Linked lists, stacks, FIFO queues, generalized queues, priority queues, heaps
• Algorithmic paradigms (6h)
o Divide and conquer
• Problem solving (14h)
o Analysis and definition of strategies for data structures and algorithms
o Search and optimization problems
o Techniques to explore the state space based on combinatorics
• Data structures for symbol tables (4h)
o Binary search trees
o Hash tables
• Graph theory (12h)
o Graph representation
o Depth-first and breadth-first search and their applications
o Shortest paths
o Minimum spanning trees.
Lectures (80h) include practice lessons. Lectures and practice are extended with 20 additional hours in laboratory to consolidate what the student has learned. Selected lab sessions may be ranked and contribute a bonus (maximum 2/30).
Texts, readings, handouts and other learning resources
Handouts and slides used during the classroom lessons are available on the teacher or course WEB site.
The World Wide Web is also an excellent source of material for almost all topics introduced in the class (see Wikipedia, for example).
Among the printed material, during the class, we make explicit usage of the following books:
• T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, "Introduction to Algorithms", McGraw-Hill.
• R. Sedgewick, "Algorithms in C, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching" Addison-Wesley Professional.
• R. Sedgewick, "Algorithms in C, Part 5: Graph Algorithms", Addison-Wesley Professional.
• B. W. Kernighan, D. M. Ritchie, "The C Programming Language", Prentice Hall, second edition.
• P. Deitel, H. Deitel, "C: how to program", Prentice Hall, eight edition.
Assessment and grading criteria
The exam consists in:
• A written part (maximum duration 2h30)
• An oral exam.
The written part includes:
• Exercises/questions on theoretical aspects to check the acquired knowledge. Maximum 12 points. Maximum duration 50 minutes.
• A programming part to check the acquired abilities. Maximum duration 1h40. Available in two alternative modes:
• Design and development of a program in C to solve a problem, the emphasis being on problem-solving and design skills (max 18 points).
• Guided development of the solution to a problem, with less emphasis on design and problem-solving skills and more on the ability to use advanced C features (pointers, dynamic allocation, recursion) and on the knowledge of basic data structures and algorithms (max 12 points).
Both modes require the same approach to the subject.
Material available during the written part:
• A C manual (e.g., Kernighan & Ritchie, Deitel & Deitel, or similar).
• Header files for standard functions/ADTs unless explicitly forbidden.
• No other books, notes, transparencies, etc.
• No electronic communication tools (cell phones, tablets, laptops, etc.).
Each student must:
• Make a copy of the program at the end of the written part (using carbon copy paper, cell phones, cameras, etc.).
• Verify the correctness of the program.
• Upload on the course webpage within 3 working days: a report (max 3 pages) describing the solution (data structures, algorithm, etc.) and a copy of the working program, showing the changes with respect to the version handed in for ranking.
In case the above material is not uploaded, the written exam will not be ranked.
Students whose mark in the written part is larger or equal to 15/30 are entitled to sit for the oral exam. The oral examination checks the capacity of the student to explain his/her design choices, to use correct technical terms, and to describe algorithms. It consists in:
• Questions on all the topics of the course, the goal being to rank the grade of theoretical knowledge.
• Programs in C to evaluate skills related to the implementation and manipulation of data structures by means of advanced C programming constructs and to the implementation of variants of standard algorithms.
• Questions on uploaded laboratory exercises.
The final mark integrates partial results (laboratory assignments when applicable, written part, and oral exam) and is not a mere average or sum of those parts.
Programma definitivo per l'A.A.2017/18