Resource-efficient programming (INF205) lab u41: 13th October 2022

1. Module feedback and recommendations

Many thanks for providing your feedback and recommendations for the module in order to keep it on track.

Make sure to log out from your Google account when answering, so that you can remain anonymous.

2. "Rule of five" for tailored containers

The rule of five applies to self-designed containers that rely at least partly on manual memory management for the data of which they have ownership. It states that for such classes, the programmer should implement each of the following, or else they will be restricted in their functionality:

In the "sequence performance" example, all the five methods/operators are implemented for the class DynamicArray. For class SinglyLinkedList and class DoublyLinkedList, only the destructor is implemented. Supplying any of the other four will extend the ways in which objects of these classes can be copied or moved.

Implement at least one of the missing constructors/operators and check that it works by using it for a simple copy/move operation.

3. Graph data structure

The "incidence list graph" example defines three classes:

There are two methods for creating a node or an edge in the graph:

class UndirInclistGraph
{
   …
   UndirInclistGraphEdge* create_edge(std::string node_a_label, int edge_label, std::string node_b_label);
   UndirInclistGraphNode* create_node(std::string node_label);
   …
};

However, there is no method for erasing a node with a given label (if it exists) or for erasing an edge between two nodes with given labels (if it exists). Implement at least one of these methods, taking care that the data structure must continue to work consistently: The graph, its edges, and its nodes.

(See how far you get with one or both of the problems 2 and 3, and submit your code and findings through Canvas - many thanks!)