Navigation
Page categories
Outline:
Last modification
2025-09-04
This is smol web. If you don't like it, fix your browser.

Infopage about the C++ lab of NPRG041.

Lab requirements#

You should do the homework (see below), create a small project in C++ (also below) and attend the course reasonably (at least adequately to your current knowledge of the topic).

To get the credit, you also need to pass the test. Tests take place in the exam period, register via SIS.

Homework#

There are 2 assignments. You should submit some (at least partial) solution to both assignments, I’ll notify you&give some time for corrections in case your solutions are not sufficient.

BONUS points gained from the homework can be applied to simplify your semester project. Usage:

  1. I complain about something that’s obviously wrong in your project
  2. You say you have a bonus point and use it
  3. I forget about both problem&bonus point, and move on to next thing.
Assignment A (due 2016/12/31): Efficient mergesort on a neat linked-list class#

Take the List class we have produced on the second lesson, and improve it in following ways:

Only restriction on your code is that you must manage the memory allocation by hand, using raw pointers and “new” and “delete” operators. Library tools like unique_ptr, shared_ptr, STL containers, etc. are not allowed.

The resulting class should be able to power this implementation of mergesort (source code is informative only, there might be mistakes, and you can do reasonable modifications). This mergesort is quite allocation-intensive (there are lots of small reallocations of the lists), you can attempt to rewrite it for less reallocations and observe the resulting speedup (it should be significant).

Assignment B (due 2017/03/31): Ultra-safe sparse matrix with rows and cols (a.k.a. MATLAB)#

UPDATE: use this skeleton code.

Write an implementation of sparse matrix of some type called smatrix<T>, that supports interesting ways of accessing content by rows or columns, and _never crashes_.

Sparse matrix is defined as a matrix that contains an overwhelming majority of zero elements. That fact is usually exploited to save memory, so the implementations only store indexes of non-zero elements.

NOTE: Although the specification seems terribly overcomplicated, this is basically an “assignment reading exercise”. After some thinking and generalization, the implementation should be pretty straightforward (except for the BONUS, which requires a bit of setup). You probably want to have a general type for all “possibly-transposed submatrix references”, e.g. all rows, cols, transposed rows, double-transposed rows and submatrices should have the same type.

Project#

Every student should create an individual project and submit it to get the credit. Topic is variable, but should be discussed and agreed upon before the end of November. Size of the project is not an issue, but at least around 500 lines of (condensed and neat) code is a good guideline.

Erasmus students may need a completely different time limit. If you are from Erasmus, contact us for details.

Bad topics:

Good topics:

Deadlines:

Timeline#

2016/10/03#
2016/10/10#
2016/10/17#
2016/10/24#
2016/10/31#
2016/11/07#
2016/11/14#

Simple stuff we didn’t manage to do on time:

2016/11/21#
2016/11/28#
2016/12/5#
2016/12/12#
2016/12/19#
Stuff in the queue#

Bonus material#