Question: A map or a dictionary, also known as an associative array, is a data structure in which key - value pairs can be inserted; then
A map or a dictionary, also known as an associative array, is a data structure in which keyvalue pairs can be inserted; then you can access any value by supplying the key. It's like an array in which you can access elements with perhaps a string index key or any other type of index. We assume that the keys are unique so if you insert a keyvalue pair and the key already exists then you just overwrite the value.
Write a C template class to represent a map. To avoid name collisions you can call your class 'Dict'. Use a BST to implement your class. You will need to create a C template class for the BST You can modify the code that we presented in class for the BST Test your mapdictionary with the following main function:
#include
#include
#include "Dict.hpp
using namespace std;
int main
Dict phonedirectory;
phonedirectory.addTom;
phonedirectory.addPat;
cout "Tom "Ext.: phonedirectoryTom endl;
cout "Pat "Ext.: phonedirectoryPat endl;
Dict idnumbers;
idnumbers.addoverline "Tom";
idnumbers.add "Pat";
cout idnumbers endl;
cout idnumbers endl;
return ;
In this case your program should output:
Tom Ext.:
Pat Ext.:
Tom
Pat
Submit all source files needed to build and run your program to Gradescope.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
