Group A - 1 - Client - Data
Group A - 1 - Client - Data
struct node
{
int value;
node* next;
}*HashTable[10];
class hashing
{
public:
hashing()
{
node* create_node(int x)
{
node* temp=new node;
temp->next=NULL;
temp->value=x;
return temp;
}
void display()
{
for(int i=0 ; i< 10; i++)
{
node * temp=new node;
temp=HashTable[i];
cout<<"a["<<i<<"] : ";
while(temp !=NULL)
{
cout<<" ->"<<temp->value;
temp=temp->next;
}
cout<<"\n";
}
}
if (entry == NULL )
{
cout<<"No Element found ";
return;
}
if(entry->value==value){
HashTable[hash_val]=entry->next;
return;
}
while ((entry->next)->value != value)
{
entry = entry->next;
}
entry->next=(entry->next)->next;
}
}
}
};
int main(){
int ch;
int data,search,del;
hashing h;
do{
cout<<"\nTelephone : \n1.Insert \n2.Display \n3.Search \n4.Delete \
n5.Exit \n\n OPTION: ";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\nEnter phone no. to be inserted : ";
cin>>data;
h.insertElement(data);
break;
case 2:
h.display();
break;
case 3:
cout<<"\nEnter the no to be searched : ";
cin>>search;
if (h.searchElement(search) == -1)
{
cout<<"No element found at key ";
continue;
}
break;
case 4:
cout<<"\nEnter the phno. to be deleted : ";
cin>>del;
h.deleteElement(del);
cout<<"Phno. Deleted"<<endl;
break;
}
}while(ch!=5);
return 0;
}