Skip to main content

Posts

Showing posts from April, 2022

Dictionary Implementation using HashTable with external chaining using Linked List | Add a Node | Update a Node | Delete a Node

   Problem Statement: Implement all the functions of a dictionary (ADT) using hashing and handle collisions using separate chaining using linked list. Data: Set of (key, value) pairs, Keys are mapped to values, Keys must be comparable, Keys must be unique. Standard Operations: Insert (key, value), Find(key), Delete(key) Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class node {     string key ;     string value ;     node * next ; public :     node ( string key , string value )     {         this -> key = key ;         this -> value = value ;         next = NULL ;     }     friend class Dictionary ; }; class Dictionary {     node * hashTable [ 10 ]; public :     Dictionary ()     {         for ( int i = 0 ; ...

Telephone Book Database Implementation using HashTable | Linear Probing with Replacement | Linear Probing without Replacement

   Problem Statement:  Consider telephone book database of N clients. Make use of a hash table implementation to quickly look up client‘s telephone number. Make use of two collision handling techniques and compare them using number of comparisons required to find a set of telephone numbers (use linear probing with replacement and without replacement) Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class record {     string name ;     long long int number ;     int link ; public :     record ()     {         this -> name = "" ;         this -> number = 0 ;         link = - 1 ;     }     record ( string name , long long int number )     {         this -> name = name ;         this -> number = number ;  ...