Skip to content

Commit

Permalink
added hash table implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sainitishkumar authored and yshshrm committed Mar 13, 2020
1 parent 5f20710 commit e8db9d8
Show file tree
Hide file tree
Showing 6 changed files with 666 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cpp/data_structures/Hash_implementation/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CC=g++
Output:main.o hash.o
$(CC) main.o hash.o -o nameht
main.o:main.cpp
$(CC) -c main.cpp
hash.o:hash.cpp
$(CC) -c hash.cpp
clean:
rm *.o nameht
32 changes: 32 additions & 0 deletions cpp/data_structures/Hash_implementation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Implement Hash ADT with closed Hashing.

Consider the dataset given for previous laboratory session on BSTs. Further consider the field,
Name N as a key. Assume that all keys at least 5 characters long and may discard keys/records
which are shorter than 5 characters. Implement Hash table ADT with the necessary member
functions,
• to initialize the hash table (HT) with a specific size and specific collision resolving technique
• to insert a record with the given key
• to delete a record with the given key
• to find a record with the given key
• to rehash the hash table when load factor λ > 0.75
• to print the statistics of number of probes for unsuccessful U and successful S find operations
carried out so far and current load factor λ
format of execution:
./nameht option [SIZE] [KEY] [CR]
option:
1. to initialize hash table for specific SIZE and CR
2. to find a given KEY
3. to insert a given KEY
4. to delete a given KEY
5. to compute load factor
6. to rehash hash table to a given size SIZE
7. to display statistics
Arguments mentioned in [ ] brackets are optional.
Example:
./nameht 1 500 LP - to create a hash table with size 500 slots and linear probing resolving
technique
./nameht 2 “vijay kumar” - find the name “vijay kumar” in the hash table. If exists, print its
frequency
./nameht 4 arun - delete the record with Key “arun”

Binary file not shown.
Loading

0 comments on commit e8db9d8

Please sign in to comment.