Question: #include using namespace std; #includequeue template class AssociativeArray { struct Node { K key; V value; Node * next; }; Node * firstnode,* lastnode; int

#include

using namespace std;

#include"queue"

template class AssociativeArray { struct Node { K key; V value; Node * next; }; Node * firstnode,* lastnode; int siz; public: AssociativeArray (){firstnode=0;lastnode=0;siz=0;} AssociativeArray( const AssociativeArray&); AssociativeArray &operator=(const AssociativeArray&); ~AssociativeArray(); int Size(){return siz;} V operator[](const K&) const;//getter V& operator[](const K&);//setter bool containkey(const K&) const; void deletekey(const K&); queue Keys()const; void Clear(); }; template V operator[](const K& key1) const { int t=0; for(Node*p=firstnode;p;p=p->next) if(p->key==key1) {t=1; return p->value;} if(t==0) { V dummy; return dummy; } } template V& operator[](const K&key) { int t=0; for(Node*p=firstnode;p;p=p->next) if(p->key==key) {t=1; return p->value;} if(t==0) { ++siz; Node *temp =new Node; temp->key=key; temp->value=V(); temp->next=firstnode; firstnode=temp; return firstnode->value; } } template bool containkey(const K&key) const { int t=0; for(Node*p=firstnode;p;p=p->next) if(p->key==key) {t=1; return true;} if(t==0) { return false; } } template void deletekey(const K&key) { Node *p,prev; for(p=firstnode, prev=0;p;prev=p,p=p->next) if(p->key==key) break; if(p) { --siz; if(prev)prev->next=p->next; else firstnode=p->next; delete p; } } template queue Keys()const { queue ke; for(Node*p=firstnode;p;p=p->next) { ke.push(p->key); } return ke; }

will you correct this program's problem, thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!