CSC727 -Assignment

A dictionary is a list of elements composed of similar data ordered by subset of the data called a "key". For example considerer the following structure for a government database:

struct veterant {

char * Name;

char * Address;

char * City;

char * State;

int Zip[5];

int Social_num [9];

}

Since Social_num uniquely identifies each veterant, is the "key" for which the dictionary is then ordered, that is, for example a key :150453456 comes before key:154567899, since the first social number is less the second one.

The dictionary C++ program (using a linked list Chain) can be found on my web-page (www.cs.csi.cuny.edu/~petingi/main.html).

You must write a function called Merge

SortedChain<E,K& SortedChain<E,K>:: Merge (SortedChain<E,K> & S2 const) {

------write your function

}

that does the following:

Suppose that we declare the following two dictionary objects:

main {

SortedChain<TypeE, long> Chain1;

SortedChain<TypeE, long> Chain2;

Suppose Chain1 is :

where 5,8,and 9 are the keys, and suppose

Chain2 is :

then Chain1.Merge(Chain2) should be

The Merge function will change Chain1, thus you must return a reference to Chain1

, that is return(*this).