Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added hash table implementation in cpp #651

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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