Question: This question is based on the assignment on hash. struct node { int num; int freq; / / number of times the given num has

This question is based on the assignment on hash.
struct node
{ int num;
int freq; //number of times the given num has occurred
node *next;
};
class hash_array
{ node * begin;
public:
hash_array();
void insert(int n);
}
Using the above declaration you need to write the following
a) insert function - Traverse the linked list. If you find the "num" existing increase the frequency else add the "num" at the end of linked list.
b) main function - Declare the array, read an integer, generate the hash key, and call the insert function.
This question is based on the assignment on hash.

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 Programming Questions!