design-hashmap 1.0.0
Design HashMap
Loading...
Searching...
No Matches
main.cpp File Reference
#include <bits/stdc++.h>
Include dependency graph for main.cpp:

Go to the source code of this file.

Data Structures

class  MyHashMap
 

Macros

#define SIZE   100
 

Functions

int main ()
 

Macro Definition Documentation

◆ SIZE

#define SIZE   100

Definition at line 3 of file main.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 67 of file main.cpp.

68{
69 MyHashMap* obj = new MyHashMap();
70 obj->put(1, 1);
71 obj->put(2, 2);
72 int value = obj->get(1);
73 cout << value << endl;
74 value = obj->get(3);
75 cout << value << endl;
76 obj->put(2, 1);
77 value = obj->get(2);
78 cout << value << endl;
79 obj->remove(2);
80 value = obj->get(2);
81 cout << value << endl;
82 delete obj;
83}
int get(int key)
Retrieves value of the key.
Definition main.cpp:46
void remove(int key)
Retrieves valid list and removes entry for key-value pair.
Definition main.cpp:60
void put(int key, int value)
Retrieves valid list and set/appends new value with given key.
Definition main.cpp:28

References MyHashMap::get(), MyHashMap::put(), and MyHashMap::remove().