I want to create a hash table where I can store value with pointers as key. For example In C++ if we define a linked list as:
struct Node{
int val;
Node* next;
}
I can create a hash table with pointers of Node
using std::unordered_map
or std::map
like:
unordered_map<Node*,int> um;
Node* a = (Node*)malloc(sizeof(Node));
um[a]=12;
cout<<um[a]<<endl //This prints 12
Now if I want to do this without the standard library how can I calculate the hash value for Node
pointers?