Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Singly Linked List Dictionary

The job involves implementing a dictionary as a C++ class, using a singly linked list as the
internal structure. The public interface will be provided below.
No containers from the C++ standard libraries should be used, implementation should be
done with a purpose made singly linked list using pointers and explicit recursion.
The linked list should consist of a finite sequence of nodes, where each node stores a key,
an item, and a pointer to the next node in the sequence. Initially, the type of both keys and
items in this dictionary should be std::string.

The Dictionary class should use the following public interface:


class Dictionary
{
public:
Dictionary ();
using Key = std::string ;
using Item = std::string ;
void insert (Key, Item);
Item * lookup (Key);
void remove (Key);
};

Regarding insert
-

If the key is already present in the dictionary, then the associated item should be
overwritten by the item being inserted.

Regarding lookup
-

If the key is not present in the dictionary, then a null pointer should be returned.

Regarding remove
-

If the key is not present in the dictionary, then the dictionary should not be
modified.

Ideally
-

Dictionary implementation should not introduce any memory leaks.


Provide copy operations that do not introduce sharing of nodes (i.e. a deep copy).
Provide efficient move operations.
Simple documentation explaining functions and implementation.

Must be original code written from scratch, no use of standard C++ library.

Budget - $120
Initial Implementation - $70
Full Implementation (Inc. No memory leaks, deep copy, efficient move operations, simple
documentation) - $50

Ideal Deadline 07/01/17


Final Deadline 18/01/17

Last updated 30/12/16

You might also like