Back
ExamFull examExam paper only

08 09 2022 E TS

Full exam for Algorithms and parallel computing in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: Algorithms and Parallel Computing Course 052496 Prof. Danilo Ardagna Date: 08-09-2022 Last Name: ............................................................. First Name: ............................................................. Student ID:

Algorithms and parallel computingFull exam

Document information

What's included in this study material

Full exam for Algorithms and parallel computing in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: Algorithms and Parallel Computing Course 052496 Prof. Danilo Ardagna Date: 08-09-2022 Last Name: ............................................................. First Name: ............................................................. Student ID:

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

Algorithms and Parallel Computing Course 052496 Prof. Danilo Ardagna Date: 08-09-2022 Last Name: ............................................................. First Name: ............................................................. Student ID: ............................................................. Signature: ............................................................... Exam duration: 2 hours and 15 minutes Students can use a pen or a pencil for answering questions. Students are NOT permitted to use books, course notes, calculators, mobile phones, and similar connected devices. Students are NOT permitted to copy anyone else’s answers, pass notes amongst themselves, or engage in other forms of misconduct at any time during the exam. Writing on the cheat sheet is NOT allowed. Exercise 1: Exercise 2: Exercise 3: Exercise 1 (12 points) You have to implement a class to support matrices which allow alternatively access to their elements in row or column-major ordering. From WikepediA, row-major order and column-major order are methods for storing multidimensional arrays in linear storage. The difference between the orders lies in which elements of an array are accessed one after another. In row-major order, the consecutive elements of a row reside next to each other, whereas the same holds true for consecutive elements of a column in column-major order. As an example, according to the following code: Matrix m1 ("col-major",2,3, {0,1,2,3,4,5}); Matrix m2 ("row-major",2,3,{6,7,8,9,10,11}); cout << "m1" << endl; m1.print(); cout << std::endl; cout << "m2" << endl; m2.print(); m2.switch_ordering(); cout << "m2 after switch_ordering()" << endl; m2.print(); m2.switch_ordering(); cout << "m2 after switch_ordering()" << endl; m2.print(); you get the following output: 1 m1 0…

Preview

First page of the document.

First page: 08 09 2022 E TS