diff --git a/Contributor.md b/Contributor.md index f5e54de..5c1f06a 100644 --- a/Contributor.md +++ b/Contributor.md @@ -12,4 +12,6 @@ - [Shams66789](https://github.com/Shams66789) - [Mainak29](https://github.com/Mainak29) - [Gourav9152-ai](https://github.com/Gourav8152-ai) +- [zhcet19](https://github.com/zhcet19) - [Suswagata23](https://github.com/Suswagata23) + diff --git a/open chaining.c b/open chaining.c new file mode 100644 index 0000000..ae0bcc1 --- /dev/null +++ b/open chaining.c @@ -0,0 +1,114 @@ +#include +#include +#include +#include +int row=50; +int col=5; +int A[50][5]; +int loc[50]; +int hashCode(int key) + { + return key % 47; + } + + void insert(int value) + { + int index=hashCode(value); + + for(int i=0;i Insert\n 2-> Delete\n 3-> Searching\n \n"); + scanf("%d",&ch); + switch(ch){ + case 1: + printf("Inserting element in Hashtable\n"); + //setting up upper and lower limit for element of array + int lower = 0, upper = 999; + srand(time(0)); + for(int i=0;i<40;i++) + { + insert((rand() % (upper - lower + 1))+lower); + } + break; + case 2: + printf("Deleting in Hashtable \n Enter the value to delete-:"); + scanf("%d", &value); + Delete_by_open_chaining(value); + break; + + case 3: + printf("Searching in Hashtable \n Enter the key to search-:"); + scanf("%d", &value); + search_by_open_chaining(value); + break; + default: + printf("Enter correct choice\n"); + break; + } + }while(ch); + return 0; +} +